summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Kelley <simon@thekelleys.org.uk>2013-07-02 21:19:32 +0100
committerSimon Kelley <simon@thekelleys.org.uk>2013-07-02 21:19:32 +0100
commit625ac28c61b0a5e6a252db00d72fbac6d88718fd (patch)
tree2504a44bb4ed2f7b54496ab217b3a73384ca3473
parentb4b93080799fe26f18f0595b8e047dd1629c8007 (diff)
downloaddnsmasq-625ac28c61b0a5e6a252db00d72fbac6d88718fd.tar.gz
Fix crash with empty DHCP string options.
-rw-r--r--CHANGELOG3
-rw-r--r--src/rfc2131.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 78eef33..24a665f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -60,6 +60,9 @@ version 2.67
AudioCodes Voice Gateways doing streaming writes to flash.
Thanks to Damian Kaczkowski for spotting the problem.
+ Fix crash with empty DHCP string options when adding zero
+ terminator. Thanks to Patrick McClean for the bug report.
+
version 2.66
Add the ability to act as an authoritative DNS
diff --git a/src/rfc2131.c b/src/rfc2131.c
index 499f5c4..e7fa75f 100644
--- a/src/rfc2131.c
+++ b/src/rfc2131.c
@@ -1833,7 +1833,8 @@ static int do_opt(struct dhcp_opt *opt, unsigned char *p, struct dhcp_context *c
}
}
else
- memcpy(p, opt->val, len);
+ /* empty string may be extended to "\0" by null_term */
+ memcpy(p, opt->val ? opt->val : (unsigned char *)"", len);
}
return len;
}