=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/servconf.c,v retrieving revision 1.398 retrieving revision 1.399 diff -u -r1.398 -r1.399 --- src/usr.bin/ssh/servconf.c 2023/09/06 23:21:36 1.398 +++ src/usr.bin/ssh/servconf.c 2023/09/06 23:23:53 1.399 @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.398 2023/09/06 23:21:36 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.399 2023/09/06 23:23:53 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland * All rights reserved @@ -1903,21 +1903,19 @@ } options->subsystem_name[options->num_subsystems] = xstrdup(arg); arg = argv_next(&ac, &av); - if (!arg || *arg == '\0') + if (!arg || *arg == '\0') { fatal("%s line %d: Missing subsystem command.", filename, linenum); - options->subsystem_command[options->num_subsystems] = xstrdup(arg); - - /* Collect arguments (separate to executable) */ - p = xstrdup(arg); - len = strlen(p) + 1; - while ((arg = argv_next(&ac, &av)) != NULL) { - len += 1 + strlen(arg); - p = xreallocarray(p, 1, len); - strlcat(p, " ", len); - strlcat(p, arg, len); } - options->subsystem_args[options->num_subsystems] = p; + options->subsystem_command[options->num_subsystems] = + xstrdup(arg); + /* Collect arguments (separate to executable) */ + arg = argv_assemble(1, &arg); /* quote command correctly */ + arg2 = argv_assemble(ac, av); /* rest of command */ + xasprintf(&options->subsystem_args[options->num_subsystems], + "%s %s", arg, arg2); + free(arg2); + argv_consume(&ac); options->num_subsystems++; break;