From c4a8e0fa2e45ec01a761aaadbdb2a00466981e9a Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 12 May 2022 22:54:11 +0200 Subject: [PATCH] Remove gcc 12.1 warning: strncpy specified bound depends on the length of the source argument --- client/src/cmddata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/cmddata.c b/client/src/cmddata.c index bfd4b9da0..02cbcb914 100644 --- a/client/src/cmddata.c +++ b/client/src/cmddata.c @@ -1510,10 +1510,10 @@ static int CmdRawDemod(const char *Cmd) { }; // - size_t n = MIN(strlen(Cmd), 4); - char tmp[7]; + char tmp[5]; + size_t n = MIN(strlen(Cmd), sizeof(tmp) - 1); memset(tmp, 0, sizeof(tmp)); - strncpy(tmp, Cmd, n); + strncpy(tmp, Cmd, sizeof(tmp) - 1); CLIExecWithReturn(ctx, tmp, argtable, false); bool ab = arg_get_lit(ctx, 1);