]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix processing of inet4 addr in vendor options and terminate correctly.
authorRoy Marples <roy@marples.name>
Fri, 8 Nov 2013 18:28:44 +0000 (18:28 +0000)
committerRoy Marples <roy@marples.name>
Fri, 8 Nov 2013 18:28:44 +0000 (18:28 +0000)
if-options.c

index b708108e1364d70959e8af31460b97f226c66f19..f0a09e33ee404163ff156c0a08ab8e45488daf76 100644 (file)
@@ -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;
        }
 }