diff options
author | Andreas Schwab <schwab@redhat.com> | 2011-03-29 10:40:28 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2011-04-05 13:45:23 +0200 |
commit | e513f34605747f43eed259519b6fb847591861d2 (patch) | |
tree | 7b7395a31d3c00433a8a0d1b30a94824bfbef7f5 /string | |
parent | 8cb700c0f3a503eaef660759f17fb787d0dec616 (diff) | |
download | glibc-e513f34605747f43eed259519b6fb847591861d2.zip glibc-e513f34605747f43eed259519b6fb847591861d2.tar.gz glibc-e513f34605747f43eed259519b6fb847591861d2.tar.bz2 |
Fix strncmp page test to limit length to size of object
Diffstat (limited to 'string')
-rw-r--r-- | string/test-strncmp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/string/test-strncmp.c b/string/test-strncmp.c index 00971df..880b2be 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -204,6 +204,7 @@ do_page_test (size_t offset1, size_t offset2, char *s2) { char *s1; int exp_result; + size_t max_offset = offset1 > offset2 ? offset1 : offset2; if (offset1 >= page_size || offset2 >= page_size) return; @@ -211,12 +212,12 @@ do_page_test (size_t offset1, size_t offset2, char *s2) s1 = (char *) (buf1 + offset1); s2 += offset2; - exp_result= *s1; + exp_result = *s1; FOR_EACH_IMPL (impl, 0) { - check_result (impl, s1, s2, page_size, -exp_result); - check_result (impl, s2, s1, page_size, exp_result); + check_result (impl, s1, s2, page_size - max_offset, -exp_result); + check_result (impl, s2, s1, page_size - max_offset, exp_result); } } |