Skip to content

Commit

Permalink
fix segment fault
Browse files Browse the repository at this point in the history
  • Loading branch information
clowwindy committed Jul 29, 2014
1 parent a7cd0e3 commit 4b32957
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/chinadns.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,16 @@ static void dns_handle_remote() {
// parse DNS query id
// TODO assign new id instead of using id from clients
query_id = ns_msg_id(msg);
id_addr_t *id_addr = queue_lookup(query_id);
id_addr->addr->sa_family = AF_INET;
question_hostname = hostname_from_question(msg);
LOG("response %s from %s:%d - ", question_hostname,
inet_ntoa(((struct sockaddr_in *)src_addr)->sin_addr),
htons(((struct sockaddr_in *)src_addr)->sin_port));
if (question_hostname) {
LOG("response %s from %s:%d - ", question_hostname,
inet_ntoa(((struct sockaddr_in *)src_addr)->sin_addr),
htons(((struct sockaddr_in *)src_addr)->sin_port));
}
free(src_addr);
id_addr_t *id_addr = queue_lookup(query_id);
if (id_addr) {
id_addr->addr->sa_family = AF_INET;
r = should_filter_query(msg);
if (r == 0) {
if (verbose)
Expand Down

0 comments on commit 4b32957

Please sign in to comment.