diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c index acfe97e9d..c062433ce 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.244 2015/10/27 00:49:53 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.245 2015/10/27 08:54:52 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -458,7 +458,7 @@ execute_in_shell(const char *cmd) | |||
458 | 458 | ||
459 | /* Fork and execute the command. */ | 459 | /* Fork and execute the command. */ |
460 | if ((pid = fork()) == 0) { | 460 | if ((pid = fork()) == 0) { |
461 | char *argv[] = { shell, "-c", xstrdup(cmd), NULL }; | 461 | char *argv[4]; |
462 | 462 | ||
463 | /* Child. Permanently give up superuser privileges. */ | 463 | /* Child. Permanently give up superuser privileges. */ |
464 | permanently_drop_suid(original_real_uid); | 464 | permanently_drop_suid(original_real_uid); |
@@ -472,6 +472,11 @@ execute_in_shell(const char *cmd) | |||
472 | close(devnull); | 472 | close(devnull); |
473 | closefrom(STDERR_FILENO + 1); | 473 | closefrom(STDERR_FILENO + 1); |
474 | 474 | ||
475 | argv[0] = shell; | ||
476 | argv[1] = "-c"; | ||
477 | argv[2] = xstrdup(cmd); | ||
478 | argv[3] = NULL; | ||
479 | |||
475 | execv(argv[0], argv); | 480 | execv(argv[0], argv); |
476 | error("Unable to execute '%.100s': %s", cmd, strerror(errno)); | 481 | error("Unable to execute '%.100s': %s", cmd, strerror(errno)); |
477 | /* Die with signal to make this error apparent to parent. */ | 482 | /* Die with signal to make this error apparent to parent. */ |