2014-02-14 15:54:10 +01:00
|
|
|
# related to bnc#49845, upstream bug #529
|
|
|
|
|
2014-04-14 23:53:01 +02:00
|
|
|
diff --git a/openssh-6.6p1/sshd.c b/openssh-6.6p1/sshd.c
|
|
|
|
--- a/openssh-6.6p1/sshd.c
|
|
|
|
+++ b/openssh-6.6p1/sshd.c
|
|
|
|
@@ -1405,17 +1405,21 @@ main(int ac, char **av)
|
2014-02-14 15:54:10 +01:00
|
|
|
saved_argv = xcalloc(ac + 1, sizeof(*saved_argv));
|
|
|
|
for (i = 0; i < ac; i++)
|
|
|
|
saved_argv[i] = xstrdup(av[i]);
|
|
|
|
saved_argv[i] = NULL;
|
|
|
|
|
|
|
|
#ifndef HAVE_SETPROCTITLE
|
|
|
|
/* Prepare for later setproctitle emulation */
|
|
|
|
compat_init_setproctitle(ac, av);
|
|
|
|
- av = saved_argv;
|
|
|
|
+
|
|
|
|
+ av = xmalloc(sizeof(*saved_argv) * (saved_argc + 1));
|
|
|
|
+ for (i = 0; i < saved_argc; i++)
|
|
|
|
+ av[i] = xstrdup(saved_argv[i]);
|
|
|
|
+ av[i] = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (geteuid() == 0 && setgroups(0, NULL) == -1)
|
|
|
|
debug("setgroups(): %.200s", strerror(errno));
|
|
|
|
|
|
|
|
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
|
|
|
|
sanitise_stdfd();
|
|
|
|
|