1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-28 01:07:08 -05:00

pscp -ls: fix a segfault just before exiting.

I had allocated a string, advanced a pointer along it, and then freed
that pointer instead of the pointer to the start of the string.

I'd already applied the correct fix in tolocal() in commit
841bf321d419d85, but it needed applying in get_dir_list() too.
This commit is contained in:
Simon Tatham 2024-11-24 23:15:24 +00:00
parent 0b4f758e8a
commit 4dec8fda63

6
pscp.c
View File

@ -2130,12 +2130,12 @@ static void tolocal(CmdlineArg **args, size_t nargs)
*/
static void get_dir_list(CmdlineArg **args, size_t nargs)
{
char *wsrc, *host, *user;
char *wsrc_orig, *wsrc, *host, *user;
const char *src;
const char *q;
char c;
wsrc = dupstr(cmdline_arg_to_str(args[0]));
wsrc = wsrc_orig = dupstr(cmdline_arg_to_str(args[0]));
/* Separate host from filename */
host = wsrc;
@ -2186,7 +2186,7 @@ static void get_dir_list(CmdlineArg **args, size_t nargs)
stripctrl_free(scc);
}
sfree(wsrc);
sfree(wsrc_orig);
}
/*