So I noticed that mime.c reports 3 errors when being compiled:
mime.c:309: warning: comparison between signed and unsigned
mime.c:314: warning: comparison between signed and unsigned
mime.c:363: warning: comparison between signed and unsigned
Each of those three lines has some variant of this code:
vallen = snprintf(mr->value, MIME_VALUE_MAX, "%s", startptr);
if (vallen == -1 || vallen >= MIME_VALUE_MAX)
Note that vallen (and elsewhere fieldlen) are defined thusly:
size_t fieldlen, vallen;
On most systems, size_t is unsigned and snprintf() returns int. So... there's
two options to fix this. Either a) we change those to int, or b) we check only
if the return value is *greater* than the requested size to copy. In that
case, we know that there was some error because the sign bit will be flipped,
and in an unsigned interpretation, this means that some huge value will be
represented and it will be some value lager than the requested copy size.
Aaron
mime.c:309: warning: comparison between signed and unsigned
mime.c:314: warning: comparison between signed and unsigned
mime.c:363: warning: comparison between signed and unsigned
Each of those three lines has some variant of this code:
vallen = snprintf(mr->value, MIME_VALUE_MAX, "%s", startptr);
if (vallen == -1 || vallen >= MIME_VALUE_MAX)
Note that vallen (and elsewhere fieldlen) are defined thusly:
size_t fieldlen, vallen;
On most systems, size_t is unsigned and snprintf() returns int. So... there's
two options to fix this. Either a) we change those to int, or b) we check only
if the return value is *greater* than the requested size to copy. In that
case, we know that there was some error because the sign bit will be flipped,
and in an unsigned interpretation, this means that some huge value will be
represented and it will be some value lager than the requested copy size.
Aaron