Hi
I have just found this issue in our common library with a completely different code using that stdlib.c file
I will report this asap
Paolo
Also, strncpy in that file can write 1 character beyond the specified limit;
the 4 str*cmp functions do not treat their data as unsigned char (affects the sign of the nonzero result);
the strchr function does not find '\0' at the end of the string;
the strtoul function does not always set the **ptr argument to the original *str argument when no valid number is found;
and the isspace function does not return true for \n, \r, \f, and \v.
In printf.c, the code that expands some instances of \n to CRLF should be removed.
Paolo Renzo wrote:
What strtoul(...) are you referring to? The one that comes with CW libraries?
No, the original poster referred to "stdlib.c" that comes with Niche Lite (in the common folder). He pointed out that memcmp() didn't work at all. I added that several other functions did not behave the way the standards require. Those functions are in stdlib.c, and in one case printf.c.
There is something called FNET from a freescaler named Butok which seems to have the same functions but with some of the problems fixed. His memcmp introduces another flaw (never returns negative).
One other problem: strncpy (in stdlib.c) does not pad out the buffer with zeros.