News for hackers. Stuff that matters.
Re:Security vulnerability in MySQL ubuntu by tedunangst on Monday June 11, 2012 @12:54AM (#4093269)
There is a check_scramble function which returns a my_bool, presumably a char typedef. That function itself directly returns the result of memcmp. If your memcmp implementation returns the full range of int values (allowed), 1/256 of them will have a 0 low order byte, which will then compare equal to zero when the check_scramble call is tested.

This is why real C programmers use int as their bool type. :)

Re:Security vulnerability in MySQL ubuntu by darnaut on Monday June 11, 2012 @01:04AM (#4093291)
> This is why real C programmers use int as their bool type. :)

It has the same problem if a wider type (e.g. long) is assigned to it. Use _Bool instead.

Re:Security vulnerability in MySQL ubuntu by tedunangst on Monday June 11, 2012 @01:17AM (#4093311)
I was at first tempted to complain about useless pedantry, but you're right. Even if some of us still like to party like it's 1989. I should have said the real lesson is don't reimplement standard C types, poorly.