diff options
author | djm@openbsd.org <djm@openbsd.org> | 2023-09-07 01:26:37 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2023-09-07 01:54:01 +0200 |
commit | 6e52826e2a74d077147a82ead8d4fbd5b54f4e3b (patch) | |
tree | f21142183c893f7cf33af94d3f71a65f80817ddc /servconf.c | |
parent | upstream: preserve quoting of Subsystem commands and arguments. (diff) | |
download | openssh-6e52826e2a74d077147a82ead8d4fbd5b54f4e3b.tar.xz openssh-6e52826e2a74d077147a82ead8d4fbd5b54f4e3b.zip |
upstream: allocate the subsystems array as necessary and remove the
fixed limit of subsystems. Saves a few kb of memory in the server and makes
it more like the other options.
OpenBSD-Commit-ID: e683dfca6bdcbc3cc339bb6c6517c0c4736a547f
Diffstat (limited to 'servconf.c')
-rw-r--r-- | servconf.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/servconf.c b/servconf.c index 91449d543..6650162be 100644 --- a/servconf.c +++ b/servconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: servconf.c,v 1.399 2023/09/06 23:23:53 djm Exp $ */ +/* $OpenBSD: servconf.c,v 1.400 2023/09/06 23:26:37 djm Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * All rights reserved @@ -1933,10 +1933,6 @@ process_server_config_line_depth(ServerOptions *options, char *line, break; case sSubsystem: - if (options->num_subsystems >= MAX_SUBSYSTEMS) { - fatal("%s line %d: too many subsystems defined.", - filename, linenum); - } arg = argv_next(&ac, &av); if (!arg || *arg == '\0') fatal("%s line %d: %s missing argument.", @@ -1958,6 +1954,18 @@ process_server_config_line_depth(ServerOptions *options, char *line, argv_consume(&ac); break; } + options->subsystem_name = xrecallocarray( + options->subsystem_name, options->num_subsystems, + options->num_subsystems + 1, + sizeof(options->subsystem_name)); + options->subsystem_command = xrecallocarray( + options->subsystem_command, options->num_subsystems, + options->num_subsystems + 1, + sizeof(options->subsystem_command)); + options->subsystem_args = xrecallocarray( + options->subsystem_args, options->num_subsystems, + options->num_subsystems + 1, + sizeof(options->subsystem_args)); options->subsystem_name[options->num_subsystems] = xstrdup(arg); arg = argv_next(&ac, &av); if (!arg || *arg == '\0') { |