ebpf_remove_warning: Change function call from strncpy to memcpy (#11389)
thiagoftsm committed
Aug 3, 2021 at 10:31 UTC
a3ec601cda2fd95837d821008d0485a1437f5c80
1 file changed
+2
-2
collectors/ebpf.plugin/ebpf_disk.c
+2
-2
@@ -277,7 +277,7 @@ static void update_disk_table(char *name, int major, int minor, time_t current_t
277
if (length >= NETDATA_DISK_NAME_LEN)
278
length = NETDATA_DISK_NAME_LEN;
279
280
- strncpy(w->family, name, length);
280
+ memcpy(w->family, name, length);
281
w->family[length] = '\0';
282
w->major = major;
283
w->minor = minor;
@@ -289,7 +289,7 @@ static void update_disk_table(char *name, int major, int minor, time_t current_t
289
if (length >= NETDATA_DISK_NAME_LEN)
290
length = NETDATA_DISK_NAME_LEN;
291
292
- strncpy(disk_list->family, name, length);
292
+ memcpy(disk_list->family, name, length);
293
disk_list->family[length] = '\0';
294
disk_list->major = major;
295
disk_list->minor = minor;