diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2015-10-27 08:54:53 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2015-10-27 08:54:53 +0000 |
commit | 8fe101bcc39d99286839135eb68e193c57182823 (patch) | |
tree | 2b32f509963a4a3d332551b1e4e7b6107aa7a252 /usr.bin | |
parent | 1ae96155f137189ecffb6eece603db695f0e8b39 (diff) |
fix execv arguments in a way less likely to cause grief for -portable;
ok dtucker@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/readconf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c index b2fe90a0dbf..67f475e03ab 100644 --- a/usr.bin/ssh/readconf.c +++ b/usr.bin/ssh/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.244 2015/10/27 00:49:53 djm Exp $ */ +/* $OpenBSD: readconf.c,v 1.245 2015/10/27 08:54:52 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -446,7 +446,7 @@ execute_in_shell(const char *cmd) /* Fork and execute the command. */ if ((pid = fork()) == 0) { - char *argv[] = { shell, "-c", xstrdup(cmd), NULL }; + char *argv[4]; /* Child. Permanently give up superuser privileges. */ permanently_drop_suid(original_real_uid); @@ -460,6 +460,11 @@ execute_in_shell(const char *cmd) close(devnull); closefrom(STDERR_FILENO + 1); + argv[0] = shell; + argv[1] = "-c"; + argv[2] = xstrdup(cmd); + argv[3] = NULL; + execv(argv[0], argv); error("Unable to execute '%.100s': %s", cmd, strerror(errno)); /* Die with signal to make this error apparent to parent. */ |