Fix issue detected by static analysis tool 31/295931/3 accepted/tizen/unified/20230726.163452
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 17 Jul 2023 09:56:53 +0000 (18:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 18 Jul 2023 05:50:25 +0000 (14:50 +0900)
Change-Id: If1b4102aabdb428771b2afc958af259cda8fb3b7
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/evdev-mt-touchpad.c
src/util-strings.c

index f0c26d2..ad7f333 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;
-               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 edcbf06..bc89641 100644 (file)
@@ -184,10 +184,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;