From e52f8a151ef2924190de9c534aeda0a654982d99 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 17 Jul 2023 20:02:21 +0900 Subject: [PATCH] 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 --- src/compose/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compose/parser.c b/src/compose/parser.c index f84b314..36a0c85 100644 --- a/src/compose/parser.c +++ b/src/compose/parser.c @@ -652,7 +652,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: -- 2.7.4