mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-19 09:52:06 +02:00
We now send argv to the server after parsing it in the client to get the
command, so the client should not modify it. Instead, take a copy. Fixes parsing command lists, reported by mcbride@.
This commit is contained in:
16
cmd.c
16
cmd.c
@@ -166,6 +166,22 @@ cmd_unpack_argv(char *buf, size_t len, int argc, char ***argv)
|
||||
return (0);
|
||||
}
|
||||
|
||||
char **
|
||||
cmd_copy_argv(int argc, char **argv)
|
||||
{
|
||||
char **new_argv;
|
||||
int i;
|
||||
|
||||
if (argc == 0)
|
||||
return (NULL);
|
||||
new_argv = xcalloc(argc, sizeof *new_argv);
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (argv[i] != NULL)
|
||||
new_argv[i] = xstrdup(argv[i]);
|
||||
}
|
||||
return (new_argv);
|
||||
}
|
||||
|
||||
void
|
||||
cmd_free_argv(int argc, char **argv)
|
||||
{
|
||||
|
Reference in New Issue
Block a user