Fix issue detected by static analysis tool 01/295901/2
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2023 04:56:38 +0000 (13:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2023 04:57:20 +0000 (13:57 +0900)
Change-Id: I4dbabe8feab7a260260998f3f98fb9f532dc2fbd
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/evdev-mt-touchpad.c
src/util-strings.c

index a6afbda..f0c26d2 100644 (file)
@@ -1928,7 +1928,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 525edc1..edcbf06 100644 (file)
@@ -184,7 +184,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);