power: Remove unsafe function 63/294963/5 accepted/tizen/unified/20230710.153956
authorYunhee Seo <yuni.seo@samsung.com>
Thu, 29 Jun 2023 06:25:15 +0000 (15:25 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 7 Jul 2023 04:51:33 +0000 (04:51 +0000)
To resolve build warning, strncpy is replaced by snprintf.

Change-Id: I780b09d61807f889991c89766c3560c097bc509b
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/power/power-boot.c

index ca39916..b9b1fc7 100644 (file)
@@ -159,9 +159,9 @@ static int parse_matching_boot_condition(const struct parse_result *result, void
 
        SYS_G_LIST_FOREACH(result->props, elem, prop) {
                if (MATCH(prop->key, "BootReason"))
-                       strncpy(config_bc.reason, prop->value, sizeof(prop->value) - 1);
+                       snprintf(config_bc.reason, sizeof(config_bc.reason), "%s", prop->value);
                else if (MATCH(prop->key, "BootMode"))
-                       strncpy(config_bc.mode, prop->value, sizeof(prop->value) - 1);
+                       snprintf(config_bc.mode, sizeof(config_bc.mode), "%s", prop->value);
        }
 
        if (MATCH(bc.reason, config_bc.reason) && MATCH(bc.mode, config_bc.mode))