wolfssh: config user handling fix

1. Fix where an already allocated config->user is leaked.
2. Copy the argv user name into a heap buffer.

Issue: F-4102
pull/990/head
John Safranek 2026-05-20 10:03:55 -07:00 committed by Paul Adelsbach
parent e8793bb268
commit 5f4032f831
1 changed files with 9 additions and 1 deletions

View File

@ -794,7 +794,15 @@ static int config_parse_command_line(struct config* config,
break;
case 'l':
config->user = myoptarg;
if (config->user) {
WFREE(config->user, NULL, 0);
config->user = NULL;
}
config->user = WSTRDUP(myoptarg, NULL, 0);
if (config->user == NULL) {
fprintf(stderr, "Couldn't capture the user name.\n");
exit(EXIT_FAILURE);
}
break;
case 'N':