This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [PATCH] Ensure zero termination in string/test-s*.c (was Re:segfault in test-strcmp)
- From: Roland McGrath <roland at redhat dot com>
- To: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Cc: Jakub Jelinek <jakub at redhat dot com>, <libc-alpha at sources dot redhat dot com>
- Date: Fri, 8 Nov 2002 14:42:43 -0800
- Subject: Re: [PATCH] Ensure zero termination in string/test-s*.c (was Re:segfault in test-strcmp)
> 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).