diff options
author | Alan Modra <amodra@gmail.com> | 2013-08-17 18:37:58 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-10-04 10:42:02 +0930 |
commit | e0f7a3804683f1ab3c41dfc82894bfb18d731341 (patch) | |
tree | 2ccee2995bdadfe43a98926350005813862efe32 /string/test-memcpy.c | |
parent | 466b03933234017473c12dd1d92bda5e7fe49df7 (diff) | |
download | glibc-e0f7a3804683f1ab3c41dfc82894bfb18d731341.zip glibc-e0f7a3804683f1ab3c41dfc82894bfb18d731341.tar.gz glibc-e0f7a3804683f1ab3c41dfc82894bfb18d731341.tar.bz2 |
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.
Diffstat (limited to 'string/test-memcpy.c')
-rw-r--r-- | string/test-memcpy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/string/test-memcpy.c b/string/test-memcpy.c index d121ef0..b7ebe5f 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; } |