
"Richard W.M. Jones" <rjones@redhat.com> wrote: ...
That function should also check LEN (i.e., what if it's 0 or 1?). Otherwise, STREQ might read uninitialized memory.
I've addressed that by doing something, hopefully the right thing, if len == 0. (We would expect len == 1).
Yeah, you're right. len==0 was the only missed case. I didn't realize at the time that "len" doesn't include the trailing NUL byte.
The "unsigned len = 0;" initialization looks unnecessary.
I left that because I can't see it doing any harm in this case.
It's not a big deal. True, it causes no run-time harm, but anything unnecessary can make the reviewer/maintainer wonder "why?". ...
It would have to be really really large (these are 64 bit numbers), but yes I have fixed this too.
Updated patch is attached.
Looks fine, now.