NULL guards for string functions

Karsten Fleischer
Sun Aug 17 14:34:00 GMT 2003


I noticed that the newlib string functions are not guarded against NULL
pointers and will cause coredumps if NULL arguments are passed.

Some cygwin kernel functions call newlib string functions without
checking for NULL args before (for example: mount() calls strpbrk();
mount(0,0,0) will crash).

I believe that C89/C99 standards do not impose a NULL check, but since
these functions are used in a kernel-like environment, I think they
ought to do.


More information about the Newlib mailing list