From: Alan Modra Date: Sat, 17 Aug 2013 09:07:58 +0000 (+0930) Subject: string/test-memcpy error reporting X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b921c5bc50a863b130fda0c9e7d5f50e6a4783ee;p=thirdparty%2Fglibc.git string/test-memcpy error reporting http://sourceware.org/ml/libc-alpha/2013-08/msg00094.html Using plain %s here runs the risk of segfaulting when displaying the string. src and dst aren't zero terminated strings. * string/test-memcpy.c (do_one_test): When reporting errors, print string address and don't overrun end of string. --- diff --git a/ChangeLog b/ChangeLog index 888c7d907ec..eae9d392003 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-10-04 Alan Modra + + * string/test-memcpy.c (do_one_test): When reporting errors, print + string address and don't overrun end of string. + 2013-10-04 Alan Modra * sysdeps/powerpc/powerpc64/power7/memchr.S: Replace rlwimi with diff --git a/string/test-memcpy.c b/string/test-memcpy.c index d121ef02a5c..b7ebe5f4e03 100644 --- a/string/test-memcpy.c +++ b/string/test-memcpy.c @@ -63,8 +63,8 @@ do_one_test (impl_t *impl, char *dst, const char *src, if (memcmp (dst, src, len) != 0) { - error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"", - impl->name, dst, src); + error (0, 0, "Wrong result in function %s dst %p \"%.*s\" src %p \"%.*s\" len %zu", + impl->name, dst, (int) len, dst, src, (int) len, src, len); ret = 1; return; }