From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8959 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 2/3] fix tsearch to avoid crash on oom Date: Sat, 5 Dec 2015 21:04:18 +0100 Message-ID: <20151205200418.GV23362@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1449345877 18633 80.91.229.3 (5 Dec 2015 20:04:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Dec 2015 20:04:37 +0000 (UTC) Cc: Ed Schouten To: musl@lists.openwall.com Original-X-From: musl-return-8972-gllmg-musl=m.gmane.org@lists.openwall.com Sat Dec 05 21:04:36 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1a5J4N-0005Kz-V2 for gllmg-musl@m.gmane.org; Sat, 05 Dec 2015 21:04:36 +0100 Original-Received: (qmail 25973 invoked by uid 550); 5 Dec 2015 20:04:34 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 25937 invoked from network); 5 Dec 2015 20:04:29 -0000 Mail-Followup-To: musl@lists.openwall.com, Ed Schouten Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:8959 Archived-At: 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