Mercurial > hg > dhcpcd
changeset 4713:30dc120fffbb draft
DHCP: Check we have enough for data for IP header as well.
This is totally my bad - Maciej's patch had this length check in
but somehow my patch import lost it.
| author | Maciej S. Szmigiero <mail@maciej.szmigiero.name> |
|---|---|
| date | Fri, 13 Sep 2019 12:42:17 +0100 |
| parents | bda97e54b985 |
| children | 6d4ade0ae7dc |
| files | src/dhcp.c |
| diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dhcp.c Fri Sep 13 12:37:59 2019 +0100 +++ b/src/dhcp.c Fri Sep 13 12:42:17 2019 +0100 @@ -3264,7 +3264,13 @@ if (from != NULL) from->s_addr = ip->ip_src.s_addr; + /* Check we have the IP header */ ip_hlen = (size_t)ip->ip_hl * 4; + if (ip_hlen > plen) { + errno = ENOBUFS; + return -1; + } + if (in_cksum(ip, ip_hlen, NULL) != 0) { errno = EINVAL; return -1;
