mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
stubdom/lwip-x86_64/src/core/dhcp.c: In function 'dhcp_create_request': stubdom/lwip-x86_64/src/core/dhcp.c:1361:64: error: array subscript is above array bounds The previous attempt to fix the failure above worked fine in SLE11, openSUSE 13.1 and newer. But gcc-4.5 as included in openSUSE 11.4 still failed to compile. To fix compilation also with this version of gcc move the range check right into the code instead of assigning it to a temporary variable. Signed-off-by: Olaf Hering <olaf@aepfle.de> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
14 lines
663 B
Diff
14 lines
663 B
Diff
Index: src/core/dhcp.c
|
|
===================================================================
|
|
--- src/core/dhcp.c
|
|
+++ src/core/dhcp.c
|
|
@@ -1356,7 +1358,7 @@ dhcp_create_request(struct netif *netif)
|
|
dhcp->msg_out->giaddr.addr = 0;
|
|
for (i = 0; i < DHCP_CHADDR_LEN; i++) {
|
|
/* copy netif hardware address, pad with zeroes */
|
|
- dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/;
|
|
+ dhcp->msg_out->chaddr[i] = (i < (netif->hwaddr_len > NETIF_MAX_HWADDR_LEN ? NETIF_MAX_HWADDR_LEN : netif->hwaddr_len)) ? netif->hwaddr[i] : 0/* pad byte*/;
|
|
}
|
|
for (i = 0; i < DHCP_SNAME_LEN; i++) {
|
|
dhcp->msg_out->sname[i] = 0;
|