summaryrefslogtreecommitdiff
path: root/usr.sbin/dhcpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-10-03 13:36:16 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-10-03 13:36:16 +0000
commit3aae10e9105eb5ea7d6db508633ca655f605e30a (patch)
treee3f7d6e98e211624440d8a5e0e7be3ce4c5fa5b3 /usr.sbin/dhcpd
parent8779d1dd0992f62d8d2f0c76f4f799b6cae22216 (diff)
Properly initalize the ICMP message to zero to avoid leaking 4-byte
of uninitialised memory in the sent icmp echorequest. Reported by Adarsh Dinesh (adarsh.dinesh at gmail com) OK florian@ deraadt@
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r--usr.sbin/dhcpd/icmp.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.sbin/dhcpd/icmp.c b/usr.sbin/dhcpd/icmp.c
index 512aebe6c59..61efd4232f0 100644
--- a/usr.sbin/dhcpd/icmp.c
+++ b/usr.sbin/dhcpd/icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp.c,v 1.18 2017/02/13 23:04:05 krw Exp $ */
+/* $OpenBSD: icmp.c,v 1.19 2019/10/03 13:36:15 claudio Exp $ */
/*
* Copyright (c) 1997, 1998 The Internet Software Consortium.
@@ -107,10 +107,8 @@ icmp_echorequest(struct iaddr *addr)
to.sin_family = AF_INET;
memcpy(&to.sin_addr, addr->iabuf, sizeof to.sin_addr); /* XXX */
+ memset(&icmp, 0, sizeof(icmp));
icmp.icmp_type = ICMP_ECHO;
- icmp.icmp_code = 0;
- icmp.icmp_cksum = 0;
- icmp.icmp_seq = 0;
icmp.icmp_id = getpid() & 0xffff;
icmp.icmp_cksum = wrapsum(checksum((unsigned char *)&icmp,