Commit 00b95e989b68ca057662263a18a4df576786555a

Mathieu Eyraud 2022-06-18T16:59:35

Fix read of uninitialised variable If the condition (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) is false, subtext is not initialised.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c
index 1ce8bd1..c7a7359 100644
--- a/src/core/linux/SDL_fcitx.c
+++ b/src/core/linux/SDL_fcitx.c
@@ -105,6 +105,7 @@ Fcitx_GetPreeditString(SDL_DBusContext *dbus,
         dbus->message_iter_recurse(&iter, &array);
         while (dbus->message_iter_get_arg_type(&array) == DBUS_TYPE_STRUCT) {
             dbus->message_iter_recurse(&array, &sub);
+            subtext = NULL;
             if (dbus->message_iter_get_arg_type(&sub) == DBUS_TYPE_STRING) {
                 dbus->message_iter_get_basic(&sub, &subtext);
                 if (subtext && *subtext) {