Commit 9045b035981e4273ddbb64bfb31577bbf92d8597

Peter Hutterer 2018-07-23T11:17:17

text: init the target buffer to zero 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>

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/text.c b/src/text.c
index 462d919..ec8bdf8 100644
--- a/src/text.c
+++ b/src/text.c
@@ -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;