aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0017-fix-tsearch-to-avoid-crash-on-oom.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/musl/0017-fix-tsearch-to-avoid-crash-on-oom.patch')
-rw-r--r--main/musl/0017-fix-tsearch-to-avoid-crash-on-oom.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/main/musl/0017-fix-tsearch-to-avoid-crash-on-oom.patch b/main/musl/0017-fix-tsearch-to-avoid-crash-on-oom.patch
new file mode 100644
index 0000000000..135d365ad9
--- /dev/null
+++ b/main/musl/0017-fix-tsearch-to-avoid-crash-on-oom.patch
@@ -0,0 +1,28 @@
+From bc9744763afe72d626e7b9f461001d425582fe9c Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sat, 5 Dec 2015 21:04:18 +0100
+Subject: [PATCH] fix tsearch to avoid crash on oom
+
+malloc failure was not properly propagated in the insertion method
+which led to null pointer dereference.
+---
+ src/search/tsearch_avl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/search/tsearch_avl.c b/src/search/tsearch_avl.c
+index 0864460..8c2f347 100644
+--- a/src/search/tsearch_avl.c
++++ b/src/search/tsearch_avl.c
+@@ -89,8 +89,8 @@ static struct node *insert(struct node **n, const void *k,
+ r->key = k;
+ r->left = r->right = 0;
+ r->height = 1;
++ *new = 1;
+ }
+- *new = 1;
+ return r;
+ }
+ c = cmp(k, r->key);
+--
+2.7.0
+