text: init the target buffer to zero
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 23 Jul 2018 01:17:17 +0000 (11:17 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 1 Aug 2018 03:50:38 +0000 (13:50 +1000)
There's a (theoretical?) path where we might end up strcpy() buf without ever
writing to it. This happens if the mask is nonzero but specifies a modifier
larger than the one in the xkb_mod_set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/text.c

index 462d919..ec8bdf8 100644 (file)
@@ -254,7 +254,7 @@ const char *
 ModMaskText(struct xkb_context *ctx, const struct xkb_mod_set *mods,
             xkb_mod_mask_t mask)
 {
-    char buf[1024];
+    char buf[1024] = {0};
     size_t pos = 0;
     xkb_mod_index_t i;
     const struct xkb_mod *mod;