Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/dhcpcd/dist/src Fix build failure in dhcpcd und...



details:   https://anonhg.NetBSD.org/src/rev/ef8871638cc5
branches:  trunk
changeset: 834230:ef8871638cc5
user:      kamil <kamil%NetBSD.org@localhost>
date:      Fri Aug 03 02:17:33 2018 +0000

description:
Fix build failure in dhcpcd under uUBSan

GCC with -fsanitize=undefiend detects a potential overflow in the code.
Cast the return value of ntohs(3) to size_t.

Fix merged upstream by <roy>.

diffstat:

 external/bsd/dhcpcd/dist/src/dhcp.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r d6ac26d2f2ba -r ef8871638cc5 external/bsd/dhcpcd/dist/src/dhcp.c
--- a/external/bsd/dhcpcd/dist/src/dhcp.c       Fri Aug 03 02:05:43 2018 +0000
+++ b/external/bsd/dhcpcd/dist/src/dhcp.c       Fri Aug 03 02:17:33 2018 +0000
@@ -3267,7 +3267,7 @@
        struct bootp_pkt *p;
 
        p = (struct bootp_pkt *)udp;
-       *len = ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp);
+       *len = (size_t)ntohs(p->ip.ip_len) - sizeof(p->ip) - sizeof(p->udp);
        return (char *)udp + offsetof(struct bootp_pkt, bootp);
 }
 



Home | Main Index | Thread Index | Old Index