Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src (getdelim.c:1.1)
On Tuesday 2009-07-14 11:50 +1000, matthew green output:
: - newlen = off + len + 1;
: /* Ensure that the resultant buffer length fits in ssize_t */
: - if (newlen > (size_t)SSIZE_MAX + 1) {
: + if (off + len + 1 > (unsigned int)SSIZE_MAX) {
:unsigned int will truncate this on 64 bit platforms, won't it?
:can't the cast just be removed?
I guess so. I don't remember how the compiler chooses the comparison
for this. "off", "len" and "SSIZE_MAX" are all ``ssize_t''. I would
have thought you needed to expand one of them at least (even if, as you
say, ``unsigned int'' is the wrong choice here) to get a correct
comparison generated but I guess my C skills are a bit rusty.
Regards,
Geoff
Home |
Main Index |
Thread Index |
Old Index