From aeddc61af7fe6b943e7047a8cc3f9a367edcbcfc Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 8 Nov 2013 18:28:44 +0000 Subject: [PATCH] Fix processing of inet4 addr in vendor options and terminate correctly. --- if-options.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } } -- 2.47.3