← Commit list

b67d90039

Denys Vlasenko
Denys Vlasenko
2019-01-12
SUCCESS Duration: 150s

Subject

adduser: fix a bug of getpwnam() overwriting shell name, closes 8586

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

loginutils/adduser.c+1 -1
@@ -198,7 +198,7 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
pw.pw_gecos = (char *)"Linux User,,,";
/* We assume that newly created users "inherit" root's shell setting */
- pw.pw_shell = (char *)get_shell_name();
+ pw.pw_shell = xstrdup(get_shell_name()); /* might come from getpwnam(), need to make a copy */
pw.pw_dir = NULL;
opts = getopt32long(argv, "^"