]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Fixes for IPv6 parsing with SVCB
authorWillem Toorop <willem@nlnetlabs.nl>
Mon, 22 Mar 2021 08:51:39 +0000 (09:51 +0100)
committerWillem Toorop <willem@nlnetlabs.nl>
Mon, 22 Mar 2021 08:51:39 +0000 (09:51 +0100)
str2host.c

index 09a51aa2cd400473b41b4482dbddcb5c0e8308fc..77089b04e7e8fa4ba54bd0577abe5f6fb249c51f 100644 (file)
@@ -2132,7 +2132,7 @@ parse_svcparam_ipv6hint(const char **s, uint8_t **dp, uint8_t *eod)
        }
        for (;;) {
                const char *ipv6_start = *s;
-               char        ipv6_str[40];
+               char        ipv6_str[INET6_ADDRSTRLEN];
                size_t      len;
 
                while (isxdigit(**s) || **s == ':')
@@ -2323,9 +2323,9 @@ ldns_str2rdf_svcparams(ldns_rdf **rd, const char *str)
 
        length = strlen(str);
        /* Worst case space requirement. We'll realloc to actual size later. */
-       if (!(dp = data = LDNS_XMALLOC(uint8_t, length)))
+       if (!(dp = data = LDNS_XMALLOC(uint8_t, length * 4)))
                return LDNS_STATUS_MEM_ERR;
-       eod = data + length;
+       eod = data + length * 4;
 
        /* Fill data with parsed bytes */
        for (;;) {