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>
Mon, 4 Dec 2023 10:31:00 +0000 (19:31 +0900)
Change-Id: I4dbabe8feab7a260260998f3f98fb9f532dc2fbd
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/evdev-mt-touchpad.c
src/util-strings.c

index 5b040ce548f76676843ff4953877b1a4d702fba8..9ec09face314b39701b0c41c42060b914d8206a2 100644 (file)
@@ -1923,7 +1923,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 1f9b8a748422d902752da2428253384a0e2cba67..e076b91a47fd03993cc39b7d999b4b0ad8459afd 100644 (file)
@@ -190,7 +190,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);