[PATCH] Ensure zero termination in string/test-s*.c (was Re: segfault in test-strcmp)

Roland McGrath roland@redhat.com
Fri Nov 8 15:56:00 GMT 2002


> strncpy, strncmp, strncat take a source that is described in C99 as an
> "array", not a string, so need not be terminated.  (Though in the absence
> of a null character strncmp might compare up to n characters even though
> the first difference is much earlier.)

Indeed so, and since this is purpose of strn* interfaces it seems wise to
have the testers cover the unterminated permutations as well.  The problems
that arose with the new test programs so far were in the testers for
functions that require strings (strchr, strcmp).



More information about the Libc-alpha mailing list