pass: thermal: Fix build warning 21/263221/2 accepted/tizen/unified/20210830.103730 submit/tizen/20210830.024411
authorDongwoo Lee <dwoo08.lee@samsung.com>
Mon, 30 Aug 2021 00:46:21 +0000 (09:46 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 30 Aug 2021 00:57:50 +0000 (00:57 +0000)
Since the third agrument of strncpy means maximum permitted size of
destination, using length of source string cause warning as like
"specified bound depends on the length of the source argument". This
fixes warning to use NAME_MAX instead of source length.

Change-Id: I07399700ea454100ca0924c93eca6a99cb54b8cd
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
src/thermal/thermal.c

index 06b0d6546fad52db96b27173d179b32d0aad3b0f..ae6c7f9cbab20b6b980d85d2bd9bd0e2ff14c70c 100644 (file)
@@ -304,7 +304,7 @@ static int thermal_handle_notifier_data(struct device_notifier_thermal_data *dat
        }
 
        if (entry) {
-               strncpy(entry->scenario, data->scenario, strlen(data->scenario) + 1);
+               strncpy(entry->scenario, data->scenario, NAME_MAX);
        } else {
                entry = malloc(sizeof(*data));
                if (!entry)