Skip to content

Commit 902517a

Browse files
committed
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
1 parent e8793bb commit 902517a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

apps/wolfssh/wolfssh.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,14 @@ static int config_parse_command_line(struct config* config,
794794
break;
795795

796796
case 'l':
797-
config->user = myoptarg;
797+
if (config->user) {
798+
WFREE(config->user, NULL, 0);
799+
config->user = NULL;
800+
}
801+
config->user = WSTRDUP(myoptarg, NULL, 0);
802+
if (config->user == NULL) {
803+
return -1;
804+
}
798805
break;
799806

800807
case 'N':

0 commit comments

Comments
 (0)