pass-hal: tm1: Fix overflow issue reported by savce 25/173525/1 accepted/tizen/unified/20180322.145122 submit/tizen/20180322.071622
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 22 Mar 2018 06:45:00 +0000 (15:45 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 22 Mar 2018 06:45:07 +0000 (15:45 +0900)
Change-Id: I65d800449f2feedfcd167f4519d44cde5902d53b
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/cpu/cpu.c

index 1a12f172cf96eba9d582e3497fe35111b62f6574..5e2b09d65d19020bae286144a6f0794adc3e67dc 100644 (file)
@@ -244,8 +244,8 @@ static struct pass_resource_hotplug_ops tm1_cpu_hotplug_ops = {
 
 static int tm1_cpu_get_temp(char *res_thermal_name)
 {
-       char path[PATH_MAX];
-       char buf[PATH_MAX];
+       char path[PATH_MAX + 1];
+       char buf[PATH_MAX + 1];
        char *pos;
        int temp = 0;
        int ret;
@@ -255,7 +255,7 @@ static int tm1_cpu_get_temp(char *res_thermal_name)
 
        snprintf(path, PATH_MAX, "%s%s", TMU_PATH_PREFIX, res_thermal_name);
 
-       ret = sysfs_read_str(path, buf, sizeof(buf));
+       ret = sysfs_read_str(path, buf, PATH_MAX);
        if (ret < 0)
                return ret;