diff options
author | jilles <jilles@FreeBSD.org> | 2015-03-15 11:43:51 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2015-03-15 11:43:51 +0000 |
commit | 06654ae5cb4a97978bdd4367a8acbe2ff3c3ab7b (patch) | |
tree | c5c58f7ca0e8b8c1057cc29eca7b7a0e1f0e0aea /usr.bin/env | |
parent | 3cc419d83408cc3c19bc1a08007fda0bbb55ca39 (diff) | |
download | FreeBSD-src-06654ae5cb4a97978bdd4367a8acbe2ff3c3ab7b.zip FreeBSD-src-06654ae5cb4a97978bdd4367a8acbe2ff3c3ab7b.tar.gz |
MFC r279779: env: Fix crash when -S string is not empty but no operand
follows.
split_spaces() set argc in main() incorrectly, which caused trouble for
getopt().
Examples:
env -S '\c'
env -S -i
PR: 197769
Diffstat (limited to 'usr.bin/env')
-rw-r--r-- | usr.bin/env/envopts.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/env/envopts.c b/usr.bin/env/envopts.c index f821430..5740062 100644 --- a/usr.bin/env/envopts.c +++ b/usr.bin/env/envopts.c @@ -372,9 +372,9 @@ str_done: *nextarg = NULL; /* Update optind/argc/argv in the calling routine */ - *origind = 1; - *origc += addcount; + *origc += addcount - *origind + 1; *origv = newargv; + *origind = 1; } /** |