mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
Fix the 'array subscript is above array bounds' warning correctly
Use DIAG_IGNORE_NEEDS_COMMENT instead since the compiler should have seen that NS never goes beyond MAXNS.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
2014-12-16 Siddhesh Poyarekar <siddhesh@redhat.com>
|
2014-12-16 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
|
* resolv/res_send.c (__libc_res_nsend): Disable warning 'array
|
||||||
|
subscript above bounds'
|
||||||
|
|
||||||
* resolv/res_send.c (__libc_res_nsend): Fix check for nsmap
|
* resolv/res_send.c (__libc_res_nsend): Fix check for nsmap
|
||||||
bounds.
|
bounds.
|
||||||
|
|
||||||
|
@@ -429,9 +429,15 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
|
|||||||
while (ns < MAXNS
|
while (ns < MAXNS
|
||||||
&& EXT(statp).nsmap[ns] != MAXNS)
|
&& EXT(statp).nsmap[ns] != MAXNS)
|
||||||
ns++;
|
ns++;
|
||||||
if (ns >= MAXNS)
|
if (ns == MAXNS)
|
||||||
break;
|
break;
|
||||||
|
/* NS never exceeds MAXNS, but gcc 4.9 somehow
|
||||||
|
does not see this. */
|
||||||
|
DIAG_PUSH_NEEDS_COMMENT;
|
||||||
|
DIAG_IGNORE_NEEDS_COMMENT (4.9,
|
||||||
|
"-Warray-bounds");
|
||||||
EXT(statp).nsmap[ns] = n;
|
EXT(statp).nsmap[ns] = n;
|
||||||
|
DIAG_POP_NEEDS_COMMENT;
|
||||||
map[n] = ns++;
|
map[n] = ns++;
|
||||||
}
|
}
|
||||||
EXT(statp).nscount = n;
|
EXT(statp).nscount = n;
|
||||||
|
Reference in New Issue
Block a user