summaryrefslogtreecommitdiff
path: root/lib/libedit
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-03-20 21:04:16 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-03-20 21:04:16 +0000
commit391befbcf7d4bd5f94875a622ed28eb12a8e9053 (patch)
tree9be50f74cdacfd778ca45d30e54482f1d0dca140 /lib/libedit
parent1a6015f11d99d7331192eabb204acd6d822841c8 (diff)
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@
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/tokenizer.c8
1 files changed, 5 insertions, 3 deletions
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;
}
}