summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-09-15 19:20:12 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-09-15 19:20:12 +0000
commit6dc8a74c8e2eb70363b64b09a51d0c74298c0ece (patch)
tree2e29b5f8c53c80bbf310cf3b99166ef49a9fcc3d
parent61b542ef379106207b419360c7f2761208e9dfbf (diff)
parenta0f99f6177a862e7cc22669ad04b975f685bd402 (diff)
downloaddnsmasq-nougat-mr1.6-release.tar.gz
release-request-e0cffa21-0c90-4d13-9f8c-0965a868cb5d-for-git_nyc-mr1-security-f-release-4299435 snap-temp-L00000000103192657android-7.1.1_r56nougat-mr1.6-release
Change-Id: I82c7aadabb5949fc1de3317c0a16f25b1c0ffc42
-rwxr-xr-xsrc/rfc1035.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rfc1035.c b/src/rfc1035.c
index 8ae0bfa..e440e8a 100755
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -48,7 +48,7 @@ static int extract_name(HEADER *header, size_t plen, unsigned char **pp,
/* end marker */
{
/* check that there are the correct no of bytes after the name */
- if (!CHECK_LEN(header, p, plen, extrabytes))
+ if (!CHECK_LEN(header, p1 ? p1 : p, plen, extrabytes))
return 0;
if (isExtract)
@@ -1142,6 +1142,9 @@ size_t answer_request(HEADER *header, char *limit, size_t qlen,
struct crec *crecp;
int nxdomain = 0, auth = 1, trunc = 0;
struct mx_srv_record *rec;
+
+ // Make sure we do not underflow here too.
+ if (qlen > (size_t)(limit - ((char *)header))) return 0;
/* If there is an RFC2671 pseudoheader then it will be overwritten by
partial replies, so we have to do a dry run to see if we can answer