From: Jihoon Kim Date: Mon, 17 Jul 2023 09:56:53 +0000 (+0900) Subject: Fix issue detected by static analysis tool X-Git-Tag: accepted/tizen/unified/20230726.163452^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77df39331baff49d6332940e3c2d777fa6f92984;p=platform%2Fupstream%2Flibinput.git Fix issue detected by static analysis tool Change-Id: If1b4102aabdb428771b2afc958af259cda8fb3b7 Signed-off-by: Jihoon Kim --- diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index f0c26d2d..ad7f3334 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -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, diff --git a/src/util-strings.c b/src/util-strings.c index edcbf065..bc896410 100644 --- a/src/util-strings.c +++ b/src/util-strings.c @@ -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;