Fix issue detected by static analysis tool
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2023 09:56:53 +0000 (18:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 4 Dec 2023 10:31:00 +0000 (19:31 +0900)
Change-Id: If1b4102aabdb428771b2afc958af259cda8fb3b7
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/evdev-mt-touchpad.c
src/util-strings.c

index 9ec09face314b39701b0c41c42060b914d8206a2..ead1582ce48d0bd1a672209c46a20a06a148c9ab 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;
-               snprintf(&buf[strlen(buf)], sizeof(buf),
+               snprintf(&buf[strlen(buf)], sizeof(buf)-1,
                        "slot %zd: %04d/%04d p%03d %s |",
                        i++,
                        t->point.x,
index e076b91a47fd03993cc39b7d999b4b0ad8459afd..3f589bce13f9d034edd01c6ef9e7ecc124199f40 100644 (file)
@@ -190,10 +190,10 @@ strv_join(char **strv, const char *joiner)
 
        str = zalloc(slen + 1); /* trailing \0 */
        for (s = strv; *s; s++) {
-               strncat(str, slen, *s);
+               strncat(str, *s, strlen(*s));
                --count;
                if (count > 0)
-                       strcat(str, joiner);
+                       strncat(str, joiner, strlen(joiner));
        }
 
        return str;