From 9533e44b92c3e098e640d1dabd44b3c58741dea1 Mon Sep 17 00:00:00 2001 From: fredrik Date: Thu, 12 Jan 2006 16:49:35 +0000 Subject: [PATCH] Add potential buffer overrun check. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/icmp-dn@546 959494ce-11ee-0310-bf91-de5d638817bd --- src/idnlookup.c | 4 ++++ 1 file changed, 4 insertions(+) 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) -- 2.11.0