From 67aa1d3d78a9251adbf97afc17d87b0ac7180e8e Mon Sep 17 00:00:00 2001 From: schwarze Date: Sun, 20 Mar 2016 21:04:15 +0000 Subject: Fix the same bug again that was already fixed in: OpenBSD tokenizer.c rev. 1.8 2003/08/11 18:21:40 deraadt Don't increase amax on realloc() failure. The original fix got lost in a merge along the way. This fix from Christos Zoulas via NetBSD tokenizer.c rev. 1.23 2016/02/15. OK czarkoff@ --- lib/libedit/tokenizer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/libedit/tokenizer.c') diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c index a2356101247..69335828fa3 100644 --- a/lib/libedit/tokenizer.c +++ b/lib/libedit/tokenizer.c @@ -1,5 +1,5 @@ -/* $OpenBSD: tokenizer.c,v 1.15 2016/01/30 17:32:52 schwarze Exp $ */ -/* $NetBSD: tokenizer.c,v 1.18 2010/01/03 18:27:10 christos Exp $ */ +/* $OpenBSD: tokenizer.c,v 1.16 2016/03/20 21:04:15 schwarze Exp $ */ +/* $NetBSD: tokenizer.c,v 1.23 2016/02/15 15:37:20 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -403,8 +403,10 @@ FUN(tok,line)(TYPE(Tokenizer) *tok, const TYPE(LineInfo) *line, Char **p; tok->amax += AINCR; p = reallocarray(tok->argv, tok->amax, sizeof(*p)); - if (p == NULL) + if (p == NULL) { + tok->amax -= AINCR; return -1; + } tok->argv = p; } } -- cgit v1.2.3-59-g8ed1b