Skip to content

Commit

Permalink
Avoid circular references
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Mar 7, 2015
1 parent 7fedc63 commit 11e935b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ int static parse_name(const unsigned char **inpos, const unsigned char *inend, c
if (*inpos == inend)
return -1;
int ref = ((octet - 0xC0) << 8) + *((*inpos)++);
if (ref < 0 || ref >= (*inpos)-inbuf) return -1;
if (ref < 0 || ref >= (*inpos)-inbuf-2) return -1;
const unsigned char *newbuf = inbuf + ref;
return parse_name(&newbuf, *inpos, inbuf, buf+bufused, bufsize-bufused);
return parse_name(&newbuf, (*inpos) - 2, inbuf, buf+bufused, bufsize-bufused);
}
if (octet > 63) return -1;
// copy label
Expand Down

0 comments on commit 11e935b

Please sign in to comment.