sysfs: Expand filename buffer to quiet warning

The GCC heurisitc says that the buffer can overflow by 2 bytes, expand
it.
This commit is contained in:
Michal Suchanek committed 2023-12-26 16:35:46 +01:00
1 parent f9ccac7d71
commit 43b6101bb0
1 file changed
+2 -2
+2 -2
View File
@@ -437,11 +437,11 @@ static int sensors_compute_max_sf(void)
static int sensors_get_attr_mode(const char *device, const char *attr)
{
char path[NAME_MAX];
char path[NAME_MAX + 2];
struct stat st;
int mode = 0;
snprintf(path, NAME_MAX, "%s/%s", device, attr);
snprintf(path, NAME_MAX + 2, "%s/%s", device, attr);
if (!stat(path, &st)) {
if (st.st_mode & S_IRUSR)
mode |= SENSORS_MODE_R;