aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>2018-09-19 07:37:53 +0100
committerKevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>2018-09-19 07:43:02 +0100
commit687168ccd9154b1fb7a470fa8f42ce64a135f51d (patch)
tree9680d3435e683eb31bcf3e5d48d597d03aea4c4b /package
parente8cbfedc7229348230c3f970b2376776cb0c113e (diff)
downloadupstream-687168ccd9154b1fb7a470fa8f42ce64a135f51d.tar.gz
upstream-687168ccd9154b1fb7a470fa8f42ce64a135f51d.tar.bz2
upstream-687168ccd9154b1fb7a470fa8f42ce64a135f51d.zip
dnsmasq: Handle memory allocation failure in make_non_terminals()
Backport upstream commit: ea6cc33 Handle memory allocation failure in make_non_terminals() Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Diffstat (limited to 'package')
-rw-r--r--package/network/services/dnsmasq/Makefile2
-rw-r--r--package/network/services/dnsmasq/patches/0001-Handle-memory-allocation-failure-in-make_non_termina.patch45
2 files changed, 46 insertions, 1 deletions
diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index f02416145c..936d73895e 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dnsmasq
PKG_VERSION:=2.80test6
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases
diff --git a/package/network/services/dnsmasq/patches/0001-Handle-memory-allocation-failure-in-make_non_termina.patch b/package/network/services/dnsmasq/patches/0001-Handle-memory-allocation-failure-in-make_non_termina.patch
new file mode 100644
index 0000000000..0590f47d9a
--- /dev/null
+++ b/package/network/services/dnsmasq/patches/0001-Handle-memory-allocation-failure-in-make_non_termina.patch
@@ -0,0 +1,45 @@
+From ea6cc338042094f8023d224e53c244da158e6499 Mon Sep 17 00:00:00 2001
+From: Simon Kelley <simon@thekelleys.org.uk>
+Date: Tue, 18 Sep 2018 23:21:17 +0100
+Subject: [PATCH] Handle memory allocation failure in make_non_terminals()
+
+Thanks to Kristian Evensen for spotting the problem.
+
+Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
+---
+ src/cache.c | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+--- a/src/cache.c
++++ b/src/cache.c
+@@ -1360,7 +1360,7 @@ void cache_add_dhcp_entry(char *host_nam
+ static void make_non_terminals(struct crec *source)
+ {
+ char *name = cache_get_name(source);
+- struct crec* crecp, *tmp, **up;
++ struct crec *crecp, *tmp, **up;
+ int type = F_HOSTS | F_CONFIG;
+ #ifdef HAVE_DHCP
+ if (source->flags & F_DHCP)
+@@ -1434,12 +1434,15 @@ static void make_non_terminals(struct cr
+ #endif
+ crecp = whine_malloc(sizeof(struct crec));
+
+- *crecp = *source;
+- crecp->flags &= ~(F_IPV4 | F_IPV6 | F_CNAME | F_DNSKEY | F_DS | F_REVERSE);
+- crecp->flags |= F_NAMEP;
+- crecp->name.namep = name;
+-
+- cache_hash(crecp);
++ if (crecp)
++ {
++ *crecp = *source;
++ crecp->flags &= ~(F_IPV4 | F_IPV6 | F_CNAME | F_DNSKEY | F_DS | F_REVERSE);
++ crecp->flags |= F_NAMEP;
++ crecp->name.namep = name;
++
++ cache_hash(crecp);
++ }
+ }
+ }
+