From: Tobias Stoeckmann Date: Sat, 11 Apr 2026 18:38:56 +0000 (+0200) Subject: login: Skip optarg duplication X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=7918dbf54e49a3ed48c2b59a21c8bb2d6e7d4114;p=thirdparty%2Futil-linux.git login: Skip optarg duplication Supplying -s multiple times leaks memory. The given optarg is eventually set in a struct passwd and line 1657 is the only alternative that sets a constant string, i.e. the data is neither freed nor modified. Signed-off-by: Tobias Stoeckmann --- diff --git a/login-utils/login.c b/login-utils/login.c index 0f303e753..d9e93d0dd 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1446,7 +1446,7 @@ static void initialize(int argc, char **argv, struct login_context *cxt) break; case 's': - cxt->shell_arg = xstrdup(optarg); + cxt->shell_arg = optarg; break; case 'V':