From: Roy Marples Date: Tue, 4 Jul 2017 14:29:58 +0000 (+0100) Subject: Fix processing of INFORM6 replies without an OK status code. X-Git-Tag: v7.0.0-rc2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d0f7a87cd607d8422a64e83a8d84d5e95dcd7de;p=thirdparty%2Fdhcpcd.git Fix processing of INFORM6 replies without an OK status code. While where, ensure that failure to malloc a buffer to print the status message returns -1 rather than false to indicate an error. --- diff --git a/src/dhcp6.c b/src/dhcp6.c index 2db1f97c..c7283a37 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -1734,7 +1734,7 @@ dhcp6_checkstatusok(const struct interface *ifp, } else { if ((sbuf = malloc((size_t)opt_len + 1)) == NULL) { logerr(__func__); - return false; + return -1; } memcpy(sbuf, opt, opt_len); sbuf[len] = '\0'; @@ -2877,11 +2877,11 @@ dhcp6_handledata(void *arg) case DHCP6_REPLY: switch(state->state) { case DH6S_INFORM: - if (!dhcp6_checkstatusok(ifp, r, NULL, len)) + if (dhcp6_checkstatusok(ifp, r, NULL, len) == -1) return; /* RFC4242 */ o = dhcp6_findmoption(r, len, - D6_OPTION_INFO_REFRESH_TIME, &ol); + D6_OPTION_INFO_REFRESH_TIME, &ol); if (o == NULL || ol != sizeof(uint32_t)) state->renew = IRT_DEFAULT; else {