]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Make a copy of the user when handling ssh -l, so that
authordtucker@openbsd.org <dtucker@openbsd.org>
Sun, 2 Mar 2025 07:02:49 +0000 (07:02 +0000)
committerDamien Miller <djm@mindrot.org>
Sun, 2 Mar 2025 11:06:30 +0000 (22:06 +1100)
later during User token expansion we don't end up freeing a member of argv.
Spotted by anton@'s regress tests.

OpenBSD-Commit-ID: 2f671a4f5726b66d123b88b1fdd1a90581339955

ssh.c

diff --git a/ssh.c b/ssh.c
index f6505b03abd46ff462310a1a27a87e0a717e122c..7efa863b4339411d8100d06b46d43ec9dc11316a 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.606 2025/03/01 06:11:26 dtucker Exp $ */
+/* $OpenBSD: ssh.c,v 1.607 2025/03/02 07:02:49 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1025,7 +1025,7 @@ main(int ac, char **av)
                        break;
                case 'l':
                        if (options.user == NULL)
-                               options.user = optarg;
+                               options.user = xstrdup(optarg);
                        break;
 
                case 'L':