From 1aaee548e3cbe00a084103792b03605182eefd04 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 21 Jul 2019 19:12:03 +0100 Subject: login: simplify string handling Signed-off-by: Sami Kerola --- login-utils/login.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/login-utils/login.c b/login-utils/login.c index ce112b54e..6b9d27e3e 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1355,10 +1355,7 @@ int main(int argc, char **argv) /* if the shell field has a space: treat it like a shell script */ if (strchr(pwd->pw_shell, ' ')) { - buff = xmalloc(strlen(pwd->pw_shell) + 6); - - strcpy(buff, "exec "); - strcat(buff, pwd->pw_shell); + xasprintf(&buff, "exec %s", pwd->pw_shell); childArgv[childArgc++] = "/bin/sh"; childArgv[childArgc++] = "-sh"; childArgv[childArgc++] = "-c"; -- cgit v1.2.3-55-g7522