From: Roy Marples Date: Fri, 8 Nov 2013 18:28:44 +0000 (+0000) Subject: Fix processing of inet4 addr in vendor options and terminate correctly. X-Git-Tag: v6.2.0~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aeddc61af7fe6b943e7047a8cc3f9a367edcbcfc;p=thirdparty%2Fdhcpcd.git Fix processing of inet4 addr in vendor options and terminate correctly. --- diff --git a/if-options.c b/if-options.c index b708108e..f0a09e33 100644 --- a/if-options.c +++ b/if-options.c @@ -632,9 +632,11 @@ parse_option(struct if_options *ifo, int opt, const char *arg) if (s < 6) { s = -1; errno = ENOBUFS; - } else + } else { memcpy(ifo->vendor + ifo->vendor[0] + 3, &addr.s_addr, sizeof(addr.s_addr)); + s = sizeof(addr.s_addr); + } } else { s = parse_string((char *)ifo->vendor + ifo->vendor[0] + 3, s, arg); @@ -1157,6 +1159,10 @@ finish_config(struct if_options *ifo) if (ifo->vendor[0] && !(ifo->options & DHCPCD_VENDORRAW)) { ifo->vendor[0]++; ifo->vendor[ifo->vendor[0]] = DHO_END; + /* We are called twice. + * This should be fixed, but in the meantime, this + * guard should suffice */ + ifo->options |= DHCPCD_VENDORRAW; } }