[openssh-commits] [openssh] 01/02: upstream: pass >9 commandline arguments to the internal-sftp server,
git+noreply at mindrot.org
git+noreply at mindrot.org
Sun Jun 7 09:57:14 AEST 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit e9916c44c1324ab9ab022719e4df08a390a83014
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Jun 5 08:53:07 2026 +0000
upstream: pass >9 commandline arguments to the internal-sftp server,
previously they were silently dropped; reported by Steve Caffrey ok deraadt@
OpenBSD-Commit-ID: ee6cd5430a3ca027c3223af54b58ad3cc7ccd624
---
session.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/session.c b/session.c
index dee66598e..fc9c9d6f8 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.349 2026/06/01 08:27:28 djm Exp $ */
+/* $OpenBSD: session.c,v 1.350 2026/06/05 08:53:07 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1607,21 +1607,22 @@ do_child(struct ssh *ssh, Session *s, const char *command)
exit(1);
} else if (s->is_subsystem == SUBSYSTEM_INT_SFTP) {
extern int optind, optreset;
- int i;
- char *p, *args;
+ int sftp_argc;
+ char **sftp_argv;
setproctitle("%s@%s", s->pw->pw_name, INTERNAL_SFTP_NAME);
- args = xstrdup(command ? command : "sftp-server");
- for (i = 0, (p = strtok(args, " ")); p; (p = strtok(NULL, " ")))
- if (i < ARGV_MAX - 1)
- argv[i++] = p;
- argv[i] = NULL;
+ if (argv_split(command == NULL ? "sftp-server" : command,
+ &sftp_argc, &sftp_argv, 1) != 0) {
+ error("internal error: can't split internal-sftp "
+ "arguments");
+ exit(1);
+ }
optind = optreset = 1;
- __progname = argv[0];
+ __progname = sftp_argv[0];
#ifdef WITH_SELINUX
ssh_selinux_change_context("sftpd_t");
#endif
- exit(sftp_server_main(i, argv, s->pw));
+ exit(sftp_server_main(sftp_argc, sftp_argv, s->pw));
}
fflush(NULL);
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list