[PATCH] Bad error checking after iconv() call
Jindrich Novy
jnovy at redhat.com
Mon Feb 7 13:43:34 UTC 2005
Hello,
there's bad return-value checking after iconv() call in
translate_character() in charsets.c:
count = iconv (cd, &ibuf, &ibuflen, &obuf, &obuflen);
if (count >= 0 && ibuflen == 0)
....
Please note that count is size_t, what is at the most machines unsigned
int so the left side of the condition is always true independently on
the count value. [(size_t)(-1) is returned in case iconv() fails] This
may lead to some weird drawing errors. Attached patch fixes this problem
and makes translate_character() nicer a bit.
Cheers,
Jindrich
--
Jindrich Novy <jnovy at redhat.com>, http://people.redhat.com/jnovy/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mc-iconv-error.patch
Type: text/x-patch
Size: 854 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20050207/c5c90c7c/attachment.bin>
More information about the mc-devel
mailing list