by function_seven · 11y ago · 0 comments
But, what contexts is this function used in? Is it supposed to be one-way at all? If not, then this is just a simple way of distributing vrf/ip pairs into buckets. Still smells funny, though.
EDIT: This comment looks like I'm defending the implementation here. I'm not. Seems like it'd me more uniform to just add the bytes in the vrf/IP pair and mod them with something. Seeing a hyphen in the format string of sprintf() is really weird, considering that just he string's length is being used.
Again, assuming this is in no way security-related, then this is just a general, run-of-the-mill WTF.
I didn't even go looking for bad code. I was just curious to see what language they were using. This was near the top of the first file I looked at.
The code looks like C code circa 1990. If a first glance turned up this, what else bad is in there?
In a review, I'd call out requirements for buffer overflow detection outside this function.