]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/in_dhcp.c
xnu-2782.1.97.tar.gz
[apple/xnu.git] / bsd / netinet / in_dhcp.c
index 001e1058ff4a87de9dc498278a6e93f5cc097899..e7f8ab6a895809a1ae81a324db26e61d07880740 100644 (file)
@@ -211,10 +211,10 @@ make_dhcp_request(struct dhcp * request, int request_size,
     uint8_t            cid[ETHER_ADDR_LEN + 1];
     uint8_t            rfc_magic[RFC_MAGIC_SIZE] = RFC_OPTIONS_MAGIC;
 
     uint8_t            cid[ETHER_ADDR_LEN + 1];
     uint8_t            rfc_magic[RFC_MAGIC_SIZE] = RFC_OPTIONS_MAGIC;
 
-    if (hwlen > (int)sizeof(cid)) {
+    if (hwlen >= (int)sizeof(cid)) {
        printf("dhcp: hwlen is %d (> %d), truncating\n", hwlen,
               (int)sizeof(cid));
        printf("dhcp: hwlen is %d (> %d), truncating\n", hwlen,
               (int)sizeof(cid));
-       hwlen = sizeof(cid);
+       hwlen = sizeof(cid) - 1;
     }
     bzero(request, request_size);
     request->dp_op = BOOTREQUEST;
     }
     bzero(request, request_size);
     request->dp_op = BOOTREQUEST;