From: Youngjae Cho Date: Tue, 29 Aug 2023 04:14:08 +0000 (+0900) Subject: input: Fix strndup() size X-Git-Tag: accepted/tizen/unified/riscv/20230829.104547^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified_riscv;p=platform%2Fcore%2Fsystem%2Fplugin%2Fdeviced-headless.git input: Fix strndup() size The gcc-13 blame that the size of strndup() could exceed the source size 64. Fix it to be confined to the source size. Change-Id: I4eb3ce030ad5ed949d0175f7ea00229cc1419f82 Signed-off-by: Youngjae Cho --- diff --git a/src/deviced-input/deviced-input.c b/src/deviced-input/deviced-input.c index 1680205..5b329bf 100644 --- a/src/deviced-input/deviced-input.c +++ b/src/deviced-input/deviced-input.c @@ -178,7 +178,7 @@ static void parse_condition_vconf(struct input_event_unit *ieu, const char *str) sscanf(vconfvalue, "%lf", &ieu->cv.d); } else if (!strncasecmp(vconftype, "string", sizeof("string"))) { ieu->cv.type = VCONF_TYPE_STRING; - ieu->cv.s = strndup(vconfvalue, 128); + ieu->cv.s = strndup(vconfvalue, sizeof(vconfvalue)); } else { _E("Invalid condition vconf type"); return;