aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-04-04 13:34:20 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-04-04 13:34:20 +0200
commitca37489b388764b3a8f2d558a9e9a24e3e0d4105 (patch)
tree527d3744b3e7c4e6be0cc7e5b0f39ced88c7cda7 /src
parent1cea40f2a843a4db16160b4f620cefd736fc76b5 (diff)
downloaddns-ca37489b388764b3a8f2d558a9e9a24e3e0d4105.tar.gz
fixed use after free in server.c:handle_connection()
Diffstat (limited to 'src')
-rw-r--r--src/server.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server.c b/src/server.c
index 4ca1985..4a449da 100644
--- a/src/server.c
+++ b/src/server.c
@@ -93,15 +93,15 @@ int handle_connection ( int _socket,
qname_to_fqdn( (char*) msg.question[0].qname, 100, out, 128);
printf("%s %i\n", out, msg.question[0].qtype);
}
-
- dns_destroy_struct ( &msg );
//Always return NXDOMAIN
struct dns_header head = {msg.header.id,1,OP_Q,0,0,0,0,0,NAMEERR,0,0,0,0};
char ret[20];
int retlen = dns_construct_header ( &head, ret, 20 );
sendto (_socket, ret, retlen, 0, (struct sockaddr*) sockaddr_client, sockaddr_client_len);
-
+
+ dns_destroy_struct ( &msg );
+
return 0;
}