X-Git-Url: http://dolda2000.com/gitweb/?p=icmp-dn.git;a=blobdiff_plain;f=src%2Fidnlookup.c;h=0fd367fb37482ef206dba81c82be44fd6ecbd3a1;hp=c3847963baa2660d3e13f21e69195e60be3f436a;hb=9533e44b92c3e098e640d1dabd44b3c58741dea1;hpb=3c31159f764771400fd4dfd9d7beb3922acffb24 diff --git a/src/idnlookup.c b/src/idnlookup.c index c384796..0fd367f 100644 --- a/src/idnlookup.c +++ b/src/idnlookup.c @@ -78,6 +78,10 @@ void printdn(FILE *f, unsigned char *dnbuf, size_t size, int onlyfirst) fprintf(stderr, "domain name decompression not implemented, aborting\n"); exit(1); } + if((int)*p + (p - dnbuf) >= size) { + fprintf(stderr, "malformed domain name\n"); + return; + } fprintf(f, "%.*s", (int)*p, p + 1); p += 1 + (int)*p; if(*p != 0)