diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-18 14:38:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-18 14:38:09 +0000 |
commit | 9f80b256e67a8c2c4755e0b66ae0e83abd74796a (patch) | |
tree | 053624169800a5388af4e3d78911e335ee0d78d3 /collectors/proc.plugin/proc_diskstats.c | |
parent | Releasing debian version 1.39.0-1. (diff) | |
download | netdata-9f80b256e67a8c2c4755e0b66ae0e83abd74796a.tar.xz netdata-9f80b256e67a8c2c4755e0b66ae0e83abd74796a.zip |
Merging upstream version 1.39.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/proc.plugin/proc_diskstats.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/collectors/proc.plugin/proc_diskstats.c b/collectors/proc.plugin/proc_diskstats.c index 2a4fe4f8c..09c6498e3 100644 --- a/collectors/proc.plugin/proc_diskstats.c +++ b/collectors/proc.plugin/proc_diskstats.c @@ -348,7 +348,7 @@ static inline int get_disk_name_from_path(const char *path, char *result, size_t int found = 0, preferred = 0; - char *first_result = mallocz(result_size); + char *first_result = mallocz(result_size + 1); DIR *dir = opendir(path); if (!dir) { @@ -454,7 +454,7 @@ failed: } static inline char *get_disk_name(unsigned long major, unsigned long minor, char *disk) { - char result[FILENAME_MAX + 1] = ""; + char result[FILENAME_MAX + 2] = ""; if(!path_to_device_mapper || !*path_to_device_mapper || !get_disk_name_from_path(path_to_device_mapper, result, FILENAME_MAX + 1, major, minor, disk, NULL, 0)) if(!path_to_device_label || !*path_to_device_label || !get_disk_name_from_path(path_to_device_label, result, FILENAME_MAX + 1, major, minor, disk, NULL, 0)) @@ -615,8 +615,8 @@ static struct disk *get_disk(unsigned long major, unsigned long minor, char *dis // read device uuid if it is an LVM volume if (!strncmp(d->device, "dm-", 3)) { char uuid_filename[FILENAME_MAX + 1]; - snprintfz(uuid_filename, FILENAME_MAX, path_to_sys_devices_virtual_block_device, disk); - strncat(uuid_filename, "/dm/uuid", FILENAME_MAX); + int size = snprintfz(uuid_filename, FILENAME_MAX, path_to_sys_devices_virtual_block_device, disk); + strncat(uuid_filename, "/dm/uuid", FILENAME_MAX - size); char device_uuid[RRD_ID_LENGTH_MAX + 1]; if (!read_file(uuid_filename, device_uuid, RRD_ID_LENGTH_MAX) && !strncmp(device_uuid, "LVM-", 4)) { |