action: make a note that we may not null-terminate private strings
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 1 Aug 2018 08:47:24 +0000 (18:47 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 1 Aug 2018 08:50:38 +0000 (18:50 +1000)
Coverity complains that a 7-byte string may not be null-terminated when copied
into act->data (size 7). This is fine, make a note of it.

All the strings in xkeyboard-config only use 6 bytes + null terminator so this
won't be an issue. The server (the only user of these) uses an 8-byte array
and forcibly null-terminates the string, see XkbDDXPrivate().

Everything else treats it as byte-array size 7 anyway so whether it's
null-terminated doesn't matter.

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

index 5f1fd65..f99a850 100644 (file)
@@ -705,6 +705,7 @@ HandlePrivate(struct xkb_context *ctx, const struct xkb_mod_set *mods,
                 return false;
             }
 
+            /* act->data may not be null-terminated, this is intentional */
             strncpy((char *) act->data, str, sizeof(act->data));
             return true;
         }