From: Roy Marples Date: Wed, 27 Nov 2013 21:14:43 +0000 (+0000) Subject: Fix a crash where we don't care about option length. X-Git-Tag: v6.2.0~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a990e3fe2d23521e9bbfd35621faa4be390a5799;p=thirdparty%2Fdhcpcd.git Fix a crash where we don't care about option length. --- diff --git a/dhcp-common.c b/dhcp-common.c index 3e6ea0b0..917f5d2b 100644 --- a/dhcp-common.c +++ b/dhcp-common.c @@ -116,7 +116,8 @@ dhcp_getuint32(uint32_t *i, const uint8_t *p, size_t pl) if (!p || pl < sizeof(d)) return -1; memcpy(&d, p, sizeof(d)); - *i = ntohl(d); + if (i) + *i = ntohl(d); return 0; } @@ -128,7 +129,8 @@ dhcp_getuint16(uint16_t *i, const uint8_t *p, size_t pl) if (!p || pl < sizeof(d)) return -1; memcpy(&d, p, sizeof(d)); - *i = ntohs(d); + if (i) + *i = ntohs(d); return 0; } @@ -138,7 +140,8 @@ dhcp_getuint8(uint8_t *i, const uint8_t *p, __unused size_t pl) if (!p) return -1; - *i = *(p); + if (i) + *i = *(p); return 0; }