about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-12-16 16:53:05 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-12-16 16:55:23 +0530
commita0d424ef9d7fc34f7d1a516f38c8efb1e8692a03 (patch)
treee30a4786facc2274751209651c05de9b043f082f /resolv
parent8b460906cdb8ef1501fa5dcff54206b201e527d5 (diff)
downloadglibc-a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03.tar.gz
glibc-a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03.tar.xz
glibc-a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03.zip
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.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/res_send.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 4a95eb80cb..5a9882c6ad 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++;