Fix issue detected by static analysis tool
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2023 04:56:38 +0000 (13:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 4 Feb 2025 10:03:45 +0000 (19:03 +0900)
Change-Id: I4dbabe8feab7a260260998f3f98fb9f532dc2fbd
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/evdev-mt-touchpad.c
src/util-strings.c

index d92b9eb0520c374ea9816d9ce0251f90bfe02c42..a697b3652dceb1b5edee736c82de615fab33a301 100644 (file)
@@ -1924,7 +1924,7 @@ tp_debug_touch_state(struct tp_dispatch *tp,
        tp_for_each_touch(tp, t) {
                if (i >= tp->nfingers_down)
                        break;
-               sprintf(&buf[strlen(buf)],
+               snprintf(&buf[strlen(buf)], sizeof(buf),
                        "slot %zd: %04d/%04d p%03d %s |",
                        i++,
                        t->point.x,
index 8732cc5e6c3923bf27171fb3b73c5f9f7cc77a94..523547612b447b036d213f666fb6d97e39e9d9c9 100644 (file)
@@ -192,7 +192,7 @@ strv_join(char **strv, const char *joiner)
 
        str = zalloc(slen + 1); /* trailing \0 */
        for (s = strv; *s; s++) {
-               strcat(str, *s);
+               strncat(str, slen, *s);
                --count;
                if (count > 0)
                        strcat(str, joiner);