* [PATCH 2/3] fix tsearch to avoid crash on oom
@ 2015-12-05 20:04 Szabolcs Nagy
0 siblings, 0 replies; only message in thread
From: Szabolcs Nagy @ 2015-12-05 20:04 UTC (permalink / raw)
To: musl; +Cc: Ed Schouten
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.4.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-05 20:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-05 20:04 [PATCH 2/3] fix tsearch to avoid crash on oom Szabolcs Nagy
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).