From ca37489b388764b3a8f2d558a9e9a24e3e0d4105 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sat, 4 Apr 2020 13:34:20 +0200 Subject: fixed use after free in server.c:handle_connection() --- src/server.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3