From b49f0f9b323d66056aa9cd88f9ca1a124037bf32 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 17 Aug 2021 16:04:40 -0400 Subject: [PATCH] xkb: Silence a warning from gcc 11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I get this: In function ‘TryCopyStr’, inlined from ‘CopyISOLockArgs’ at ../xkb/xkbtext.c:875:9: ../xkb/xkbtext.c:720:13: warning: ‘tbuf’ may be used uninitialized [-Wmaybe-uninitialized] 720 | strcat(to, from); | ^~~~~~~~~~~~~~~~ ../xkb/xkbtext.c: In function ‘CopyISOLockArgs’: : note: by argument 1 of type ‘const char *’ to ‘__builtin_strlen’ declared here ../xkb/xkbtext.c:871:10: note: ‘tbuf’ declared here 871 | char tbuf[64]; | ^~~~ Just initialize tbuf so it definitely works. --- xkb/xkbtext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index d2a2567fc..00a26c576 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -870,6 +870,7 @@ CopyISOLockArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz) XkbISOAction *act; char tbuf[64]; + memset(tbuf, 0, sizeof(tbuf)); act = &action->iso; if (act->flags & XkbSA_ISODfltIsGroup) { TryCopyStr(tbuf, "group=", sz);