diff options
author | Adam Jackson <ajax@redhat.com> | 2021-08-17 16:04:40 -0400 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2025-02-26 16:46:21 -0800 |
commit | 730c9df040546f1a98ab1b974ad2ccd1b4ad4552 (patch) | |
tree | 7ca0182902d4be19ce8fba0a35df4cb580e19734 | |
parent | e0c9b14cb27d8b729e5161945465ac89b82206b1 (diff) |
xkbtext.c: 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.
(cherry picked from xorg/xserver@b49f0f9b323d66056aa9cd88f9ca1a124037bf32)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxkbfile/-/merge_requests/24>
-rw-r--r-- | src/xkbtext.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/xkbtext.c b/src/xkbtext.c index ba337b9..4459ca7 100644 --- a/src/xkbtext.c +++ b/src/xkbtext.c @@ -1045,6 +1045,7 @@ CopyISOLockArgs(Display *dpy, XkbDescPtr xkb, XkbAction *action, XkbISOAction *act; char tbuf[64]; + memset(tbuf, 0, sizeof(tbuf)); act = &action->iso; if (act->flags & XkbSA_ISODfltIsGroup) { TryCopyStr(tbuf, "group=", sz); |