From: Jihoon Kim Date: Mon, 17 Jul 2023 11:02:21 +0000 (+0900) Subject: Fix issue detected by static analysis tool X-Git-Tag: accepted/tizen/unified/20240109.155348~8 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Flibxkbcommon.git;a=commitdiff_plain;h=627d7eb943e6dd987dad976f662e13529937cd9a Fix issue detected by static analysis tool Because sprintf assumes an arbitrarily long string, callers must be careful not to overflow the actual space of the destination. Change-Id: I4a3e641459d1da0f54db7eeb109447868906e394 Signed-off-by: Jihoon Kim --- diff --git a/src/compose/parser.c b/src/compose/parser.c index 5545a33..e1c903d 100644 --- a/src/compose/parser.c +++ b/src/compose/parser.c @@ -664,7 +664,7 @@ rhs: scanner_warn(s, "right-hand side string is too long; skipping line"); goto skip; } - strcpy(production.string, val.string.str); + strncpy(production.string, val.string.str, sizeof(production.string)-1); production.has_string = true; goto rhs; case TOK_IDENT: