From: Florian Forster Date: Fri, 2 Sep 2016 06:38:57 +0000 (+0200) Subject: df plugin: Guard strcmp() against being passed NULL pointers. X-Git-Tag: collectd-5.7.0~112 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=357cae102b2994f1874f5691dc571543111bd5fa df plugin: Guard strcmp() against being passed NULL pointers. Issue: #1835 --- diff --git a/src/df.c b/src/df.c index 4a86799c..af54c92f 100644 --- a/src/df.c +++ b/src/df.c @@ -229,7 +229,10 @@ static int df_read (void) } /* Duplicate found: leave non-NULL dup_ptr. */ - if (by_device && (strcmp (mnt_ptr->spec_device, dup_ptr->spec_device) == 0)) + if (by_device + && (mnt_ptr->spec_device != NULL) + && (dup_ptr->spec_device != NULL) + && (strcmp (mnt_ptr->spec_device, dup_ptr->spec_device) == 0)) break; else if (!by_device && (strcmp (mnt_ptr->dir, dup_ptr->dir) == 0)) break;