From 605ff25269f77c0bd78899547d3f7aee950cbf26 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Thu, 27 Oct 2022 09:48:04 +0200 Subject: [PATCH] Fixed string size for keyboard option parser --- client/common/cmdline.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 2a991910c..e761c09a5 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -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; }