input: Fix strndup() size 43/297943/4 accepted/tizen_unified_riscv accepted/tizen/unified/riscv/20230829.104547
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 29 Aug 2023 04:14:08 +0000 (13:14 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 29 Aug 2023 04:24:47 +0000 (13:24 +0900)
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 <y0.cho@samsung.com>
src/deviced-input/deviced-input.c

index 16802050299c19b2d23fc1d7562a92beb08886de..5b329bf84d2ce1aa571203c3657d7cd5cf7f5e20 100644 (file)
@@ -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;