mirror of https://github.com/wolfSSL/wolfssh.git
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-4102pull/990/head
parent
e8793bb268
commit
5f4032f831
|
|
@ -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':
|
||||
|
|
|
|||
Loading…
Reference in New Issue