diff options
author | Adam Jackson <ajax@redhat.com> | 2021-08-17 16:04:40 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2021-08-17 16:04:40 -0400 |
commit | b49f0f9b323d66056aa9cd88f9ca1a124037bf32 (patch) | |
tree | 87b364655e694a053358e4f7e6c05f3ae8ca876b | |
parent | c1138d8ec8d029de54261e355c0e5da0b001044a (diff) |
xkb: Silence a warning from gcc 11
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’:
<built-in>: 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.
-rw-r--r-- | xkb/xkbtext.c | 1 |
1 files changed, 1 insertions, 0 deletions
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); |