action: make a note that we may not null-terminate private strings 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>
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 5f1fd65..f99a850 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -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;
}