diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-12-16 16:53:05 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-12-16 16:55:23 +0530 |
commit | a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03 (patch) | |
tree | e30a4786facc2274751209651c05de9b043f082f | |
parent | 8b460906cdb8ef1501fa5dcff54206b201e527d5 (diff) | |
download | glibc-a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03.zip glibc-a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03.tar.gz glibc-a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03.tar.bz2 |
Fix 'array subscript is above array bounds' warning in res_send.c
I see this warning in my build on F21 x86_64, which seems to be due to
a weak check for array bounds. Fixed by making the bounds check
stronger.
This is not an actual bug since nscount is never set to anything
greater than MAXNS. The compiler however does not know this, so we
need the stronger bounds check to quieten the compiler.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | resolv/res_send.c | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2014-12-16 Siddhesh Poyarekar <siddhesh@redhat.com> + + * resolv/res_send.c (__libc_res_nsend): Fix check for nsmap + bounds. + 2014-12-16 Arjun Shankar <arjun.is@lostca.se> * libio/tst-fopenloc.c: Use test-skeleton.c. diff --git a/resolv/res_send.c b/resolv/res_send.c index 4a95eb8..5a9882c 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -429,7 +429,7 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen, while (ns < MAXNS && EXT(statp).nsmap[ns] != MAXNS) ns++; - if (ns == MAXNS) + if (ns >= MAXNS) break; EXT(statp).nsmap[ns] = n; map[n] = ns++; |