diff options
author | 2016-03-20 21:04:15 +0000 | |
---|---|---|
committer | 2016-03-20 21:04:15 +0000 | |
commit | 67aa1d3d78a9251adbf97afc17d87b0ac7180e8e (patch) | |
tree | 53b32965ee1383bf2667bfbb741a09b17b5e90f1 /lib/libedit/tokenizer.c | |
parent | Delete the useless Int datatype and always use the standard wint_t (diff) | |
download | wireguard-openbsd-67aa1d3d78a9251adbf97afc17d87b0ac7180e8e.tar.xz wireguard-openbsd-67aa1d3d78a9251adbf97afc17d87b0ac7180e8e.zip |
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/tokenizer.c')
-rw-r--r-- | lib/libedit/tokenizer.c | 8 |
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; } } |