From: Todd C. Miller <Todd.Miller@courtesan.com> Date: Mon, 26 Jul 2010 16:34:27 +0000 (-0400) Subject: sudo_pwdup() was not expanding an empty pw_shell to _PATH_BSHELL X-Git-Tag: SUDO_1_7_4~25 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c02b08e0f33f6dfa5e67dd5dcdd4db6bfee7024d;p=sudo sudo_pwdup() was not expanding an empty pw_shell to _PATH_BSHELL --HG-- branch : 1.7 --- diff --git a/pwutil.c b/pwutil.c index 3bdc88a88..35524f355 100644 --- a/pwutil.c +++ b/pwutil.c @@ -135,7 +135,9 @@ sudo_pwdup(pw) #endif FIELD_SIZE(pw, pw_gecos, gsize); FIELD_SIZE(pw, pw_dir, dsize); - FIELD_SIZE(pw, pw_shell, ssize); + /* Treat shell specially since we expand "" -> _PATH_BSHELL */ + ssize = strlen(pw_shell) + 1; + total += ssize; if ((cp = malloc(total)) == NULL) return(NULL); @@ -154,7 +156,9 @@ sudo_pwdup(pw) #endif FIELD_COPY(pw, newpw, pw_gecos, gsize); FIELD_COPY(pw, newpw, pw_dir, dsize); - FIELD_COPY(pw, newpw, pw_shell, ssize); + /* Treat shell specially since we expand "" -> _PATH_BSHELL */ + memcpy(cp, pw_shell, ssize); + newpw->pw_shell = cp; return(newpw); }