From: Yunhee Seo Date: Thu, 29 Jun 2023 06:25:15 +0000 (+0900) Subject: power: Remove unsafe function X-Git-Tag: accepted/tizen/unified/20230710.153956^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1cdf39aebe56a6d23a904136661f70b74f09c3e;p=platform%2Fcore%2Fsystem%2Fdeviced.git power: Remove unsafe function To resolve build warning, strncpy is replaced by snprintf. Change-Id: I780b09d61807f889991c89766c3560c097bc509b Signed-off-by: Yunhee Seo --- diff --git a/src/power/power-boot.c b/src/power/power-boot.c index ca39916..b9b1fc7 100644 --- a/src/power/power-boot.c +++ b/src/power/power-boot.c @@ -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))