summaryrefslogtreecommitdiff
path: root/src/rfc1035.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rfc1035.c')
-rw-r--r--src/rfc1035.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rfc1035.c b/src/rfc1035.c
index 26a2254..de009d0 100644
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -564,8 +564,12 @@ static size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned
if (optno != 0)
{
+ if (p + 4 > limit)
+ return plen; /* Too big */
PUTSHORT(optno, p);
PUTSHORT(optlen, p);
+ if (p + optlen > limit)
+ return plen; /* Too big */
memcpy(p, opt, optlen);
p += optlen;
}