[dnsmasq/f19] Fix crash when specified empty DHCP option

Tomas Hozza thozza at fedoraproject.org
Tue Jul 23 18:48:18 UTC 2013


commit 98233cc623646b3db3c9e88121e24f01d64ca76b
Author: Tomas Hozza <thozza at redhat.com>
Date:   Tue Jul 23 20:46:45 2013 +0200

    Fix crash when specified empty DHCP option
    
    Signed-off-by: Tomas Hozza <thozza at redhat.com>

 ...-Fix_crash_with_empty_DHCP_string_options.patch |   26 ++++++++++++++++++++
 dnsmasq.spec                                       |    8 +++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/dnsmasq-2.66-Fix_crash_with_empty_DHCP_string_options.patch b/dnsmasq-2.66-Fix_crash_with_empty_DHCP_string_options.patch
new file mode 100644
index 0000000..f20b113
--- /dev/null
+++ b/dnsmasq-2.66-Fix_crash_with_empty_DHCP_string_options.patch
@@ -0,0 +1,26 @@
+From 625ac28c61b0a5e6a252db00d72fbac6d88718fd Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon at thekelleys.org.uk>
+Date: Tue, 2 Jul 2013 21:19:32 +0100
+Subject: [PATCH] Fix crash with empty DHCP string options.
+
+---
+ src/rfc2131.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletions(-)
+
+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;
+ }
+-- 
+1.7.2.5
+
diff --git a/dnsmasq.spec b/dnsmasq.spec
index 739780d..279ea3a 100644
--- a/dnsmasq.spec
+++ b/dnsmasq.spec
@@ -13,7 +13,7 @@
 
 Name:           dnsmasq
 Version:        2.66
-Release:        7%{?extraversion}%{?dist}
+Release:        8%{?extraversion}%{?dist}
 Summary:        A lightweight DHCP/caching DNS server
 
 Group:          System Environment/Daemons
@@ -59,6 +59,8 @@ Patch15:        %{name}-2.66-Log-forwarding-table-overflows.patch
 Patch16:        %{name}-2.66-Allow-constructed-ranges-from-interface-address-at-end-of-range.patch
 # commit e2ba0df2d4798e52e188c2f7f74613867d5aa82a
 Patch17:        %{name}-2.66-Dont-BIND-DHCP-socket-if-more-interfaces-may-come.patch
+# commit 625ac28c61b0a5e6a252db00d72fbac6d88718fd
+Patch18:        %{name}-2.66-Fix_crash_with_empty_DHCP_string_options.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -112,6 +114,7 @@ query/remove a DHCP server's leases.
 %patch15 -p1 -b .log_overflow
 %patch16 -p1 -b .constr_range
 %patch17 -p1 -b .bindtodevice
+%patch18 -p1 -b .empty_dhcp_opts
 
 # use /var/lib/dnsmasq instead of /var/lib/misc
 for file in dnsmasq.conf.example man/dnsmasq.8 man/es/dnsmasq.8 src/config.h; do
@@ -192,6 +195,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/dhcp_*
 
 %changelog
+* Tue Jul 23 2013 Tomas Hozza <thozza at redhat.com> - 2.66-8
+- Fix crash when specified empty DHCP option
+
 * Tue Jun 11 2013 Tomas Hozza <thozza at redhat.com> - 2.66-7
 - use _hardened_build macro instead of hardcoded flags
 - include several fixies from upstream repo:


More information about the scm-commits mailing list