Commit af2b20ee authored by Mark Andrews's avatar Mark Andrews

4574. [bug] Dig leaked memory with multiple +subnet options.

                        [RT #44683]
parent 1df7a6fe
4574. [bug] Dig leaked memory with multiple +subnet options.
[RT #44683]
4573. [func] Query logic has been substantially refactored (e.g.
query_find function has been split into smaller
functions) for improved readability, maintainability
......
......@@ -1378,7 +1378,10 @@ plus_option(const char *option, isc_boolean_t is_batchfile,
}
if (lookup->edns == -1)
lookup->edns = 0;
if (lookup->ecs_addr != NULL) {
isc_mem_free(mctx, lookup->ecs_addr);
lookup->ecs_addr = NULL;
}
result = parse_netprefix(&lookup->ecs_addr, value);
if (result != ISC_R_SUCCESS)
fatal("Couldn't parse client");
......
......@@ -1096,6 +1096,8 @@ parse_netprefix(isc_sockaddr_t **sap, const char *value) {
isc_boolean_t prefix_parsed = ISC_FALSE;
char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX/128")];
REQUIRE(sap != NULL && *sap == NULL);
if (strlcpy(buf, value, sizeof(buf)) >= sizeof(buf))
fatal("invalid prefix '%s'\n", value);
......
......@@ -269,6 +269,14 @@ if [ -x ${DIG} ] ; then
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking dig +subnet +subnet ($n)"
ret=0
$DIG $DIGOPTS +tcp @10.53.0.2 +subnet=127.0.0.0 +subnet=127.0.0.1 A a.example > dig.out.test$n 2>&1 || ret=1
grep "CLIENT-SUBNET: 127.0.0.1/32/0" < dig.out.test$n > /dev/null || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
n=`expr $n + 1`
echo "I:checking dig +subnet with various prefix lengths ($n)"
ret=0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment