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/20240105.013022~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=790e528dccfada24e476c3c1fdcc0322bff88673;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 9ec09fac..ead1582c 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -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, diff --git a/src/util-strings.c b/src/util-strings.c index e076b91a..3f589bce 100644 --- a/src/util-strings.c +++ b/src/util-strings.c @@ -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;