X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdisk.c;h=20afd30b602fca4b10e9ccfe1b8a9ecfbf22a15c;hb=6acb19befc321c501e4d8b79f403ebda0c021acc;hp=6ed71b2853396f22eb848f504cffa16586a1d407;hpb=af46a5f31a0e8d4279d63d8ca9232dbd433dfb25;p=collectd.git diff --git a/src/disk.c b/src/disk.c index 6ed71b28..20afd30b 100644 --- a/src/disk.c +++ b/src/disk.c @@ -213,8 +213,8 @@ static void disk_submit (const char *plugin_instance, vl.values = values; vl.values_len = 2; vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "disk"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "disk", sizeof (vl.plugin)); strncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance)); @@ -452,7 +452,7 @@ static int disk_read (void) major = atoll (fields[0]); minor = atoll (fields[1]); - disk_name = fields[2]; + disk_name = fields[2 + fieldshift]; for (ds = disklist, pre_ds = disklist; ds != NULL; pre_ds = ds, ds = ds->next) if (strcmp (disk_name, ds->name) == 0)