Permalink
Browse files

fix for a memory corruption bug

  • Loading branch information...
1 parent 0a4f9bf commit e68f2ae58a580b10e1e5d6ae471005a253754b1e @antirez committed Dec 9, 2010
Showing with 3 additions and 0 deletions.
  1. +3 −0 response.c
View
@@ -106,14 +106,17 @@ byte *build_response(u_int16_t qclass, u_int16_t qtype, char *qname, char *name,
/* Add the matching RRs found */
for (j = 0; j < ret; j++) {
struct RRentry *rr = rrs[j];
+ char *origname;
/* build the needed Additional RRs list */
arr_index += additional_rr_needed(&arr[arr_index],
rrs[j], arr_index);
/* add the RR. Note that even if we matched a wildcard
* local RR, we add the requested name in the query */
+ origname = rr->name;
rr->name = qname;
+ rr->name = origname;
/* ready to add the RR i the response */
retsize = add_rr(&response, hdr, rr,
response_size, AN_SECTION, maxsize);

0 comments on commit e68f2ae

Please sign in to comment.