Fixed string size for keyboard option parser

This commit is contained in:
Armin Novak 2022-10-27 09:48:04 +02:00 committed by akallabeth
parent 967749d43f
commit 605ff25269

View File

@ -2042,11 +2042,12 @@ static int parse_kbd_options(rdpSettings* settings, const COMMAND_LINE_ARGUMENT_
{
const size_t olen = strlen(old);
const size_t alen = strlen(now);
char* tmp = calloc(olen + alen + 1, sizeof(char));
const size_t tlen = olen + alen + 2;
char* tmp = calloc(tlen, sizeof(char));
if (!tmp)
rc = COMMAND_LINE_ERROR_MEMORY;
else
_snprintf(tmp, olen + alen + 1, "%s,%s", old, now);
_snprintf(tmp, tlen, "%s,%s", old, now);
now = tmp;
}