]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure we have a big enough buffer for an escaped DNSSL option.
authorRoy Marples <roy@marples.name>
Wed, 7 Nov 2012 14:19:45 +0000 (14:19 +0000)
committerRoy Marples <roy@marples.name>
Wed, 7 Nov 2012 14:19:45 +0000 (14:19 +0000)
ipv6rs.c

index 5968682cbbcabd98182c56ff1aa21e23b5020654..7072b2a0a6052fe0c2520070c2657445e4d36980 100644 (file)
--- a/ipv6rs.c
+++ b/ipv6rs.c
@@ -687,10 +687,13 @@ ipv6rs_handledata(_unused void *arg)
                                syslog(LOG_ERR, "%s: invalid DNSSL option",
                                    ifp->name);
                        } else {
-                               opt = xmalloc(l);
                                tmp = xmalloc(l);
                                decode_rfc3397(tmp, l, n, op);
-                               l = print_string(opt, l, l - 1, (uint8_t *)tmp);
+                               n = print_string(NULL, 0,
+                                   l - 1, (const uint8_t *)tmp);
+                               opt = xmalloc(n);
+                               print_string(opt, n,
+                                   l - 1, (const uint8_t *)tmp);
                                free(tmp);
                        }
                        break;