From e688080690005e5508db95d5f19c351c457302de Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 3 Jul 2015 18:41:53 +0200 Subject: hddtemp: use g_strcmp0 instead of strcmp Passing NULL to strcmp could be unsafe or at the minimum result in undefined behaviour. g_strcmp0 handles NULL gracefully and returns 0. --- plugins/hddtemp/hddtemp-plugin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/hddtemp') diff --git a/plugins/hddtemp/hddtemp-plugin.c b/plugins/hddtemp/hddtemp-plugin.c index 220c830..f7d36f5 100644 --- a/plugins/hddtemp/hddtemp-plugin.c +++ b/plugins/hddtemp/hddtemp-plugin.c @@ -151,9 +151,9 @@ static void hddtemp_plugin_get_sensors(GList **sensors) { pv = output_vector = g_strsplit(hddtemp_output, "|", -1); while(pv[1] != NULL) { - if (strcmp(pv[2], "") != 0 && - strcmp(pv[3], "") != 0 && - strcmp(pv[4], "") != 0 && + if (g_strcmp0(pv[2], "") != 0 && + g_strcmp0(pv[3], "") != 0 && + g_strcmp0(pv[4], "") != 0 && (!(g_ascii_strcasecmp(pv[2], "???") == 0 || g_ascii_strcasecmp(pv[3], "ERR") == 0 || g_ascii_strcasecmp(pv[4], "*") == 0))) { -- cgit v1.2.1