diff options
author | 2015-11-18 15:31:21 +0000 | |
---|---|---|
committer | 2015-11-18 15:31:21 +0000 | |
commit | bc7ffb069439af156f11c2f04d77ffffc170c4ef (patch) | |
tree | 872b33ada9e73bacf808019b16d72ceb2c4d5284 | |
parent | Parse the original on-disk MBR into a local variable. Use the (diff) | |
download | wireguard-openbsd-bc7ffb069439af156f11c2f04d77ffffc170c4ef.tar.xz wireguard-openbsd-bc7ffb069439af156f11c2f04d77ffffc170c4ef.zip |
Only unget match[] if it has been used, ok sthen
-rw-r--r-- | bin/ksh/lex.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c index 029d8dc5340..177c06d2275 100644 --- a/bin/ksh/lex.c +++ b/bin/ksh/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.63 2015/11/12 04:04:31 mmcc Exp $ */ +/* $OpenBSD: lex.c,v 1.64 2015/11/18 15:31:21 nicm Exp $ */ /* * lexical analysis and source input @@ -193,7 +193,7 @@ yylex(int cf) c == '!') { char **replace = NULL; int get, i; - char match[200], *str = match; + char match[200] = { 0 }, *str = match; size_t mlen; c2 = getsc(); @@ -247,12 +247,13 @@ yylex(int cf) s->u.freeme = NULL; source = s; continue; - } else { + } else if (*match != '\0') { /* restore what followed the '!' */ mlen = strlen(match); for (i = mlen-1; i >= 0; i--) ungetsc(match[i]); - } + } else + ungetsc(c2); } if (c == '[' && (cf & (VARASN|ARRAYVAR))) { *wp = EOS; /* temporary */ |