diff options
Diffstat (limited to 'cputemp.c')
-rw-r--r-- | cputemp.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -79,7 +79,7 @@ void cputemp_read_hwmon(char *hwmon,char *sensor_name,struct s_sensor *sensor) { DIR *hwmon_dir; struct dirent *hwmon_dirent; - char name_file[255]; + char name_file[258]; char input_file[255]; int offset; @@ -100,10 +100,10 @@ void cputemp_read_hwmon(char *hwmon,char *sensor_name,struct s_sensor *sensor) if (cputemp_is_label(hwmon_dirent->d_name)) { DEBUG2_CPUTEMP("Found label %s\n",hwmon_dirent->d_name); - sprintf(name_file,"%s/%s",hwmon,hwmon_dirent->d_name); - sprintf(input_file,"%s/%s",hwmon,hwmon_dirent->d_name); + snprintf(name_file,258,"%s/%s",hwmon,hwmon_dirent->d_name); + snprintf(input_file,258,"%s/%s",hwmon,hwmon_dirent->d_name); offset=strlen(input_file)-5; - strncpy(input_file+offset,"input",5); + strncpy(input_file+offset,"input",6); cputemp_match_and_validate(name_file,input_file,sensor_name,sensor); } hwmon_dirent=readdir(hwmon_dir); @@ -126,7 +126,7 @@ void cputemp_find_sensor(char *sensor_name,struct s_sensor *sensor) { DIR *hwmon_dir; struct dirent *hwmon_dirent; - char subdir[255]; + char subdir[273]; DEBUG1_CPUTEMP("Searching for sensor %s\n",sensor_name); @@ -149,7 +149,7 @@ void cputemp_find_sensor(char *sensor_name,struct s_sensor *sensor) // Note that /sys/class/hwmon actually contains symlinks but we treat them like directories if (strncmp(hwmon_dirent->d_name,"hwmon",5)==0) { - sprintf(subdir,"/sys/class/hwmon/%s",hwmon_dirent->d_name); + snprintf(subdir,273,"/sys/class/hwmon/%s",hwmon_dirent->d_name); DEBUG2_CPUTEMP("Found hwmon entry: %s\n",subdir); cputemp_read_hwmon(subdir,sensor_name,sensor); } |