From: Florian Forster Date: Sun, 2 Jan 2011 21:20:14 +0000 (+0100) Subject: src/common.c: parse_identifier_vl: Don't pass NULL to sstrncpy(). X-Git-Tag: collectd-5.0.0~30 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c9827c15fc557d7c9201f925f406023d660478eb;p=collectd.git src/common.c: parse_identifier_vl: Don't pass NULL to sstrncpy(). --- diff --git a/src/common.c b/src/common.c index 7813d5bb..142d7979 100644 --- a/src/common.c +++ b/src/common.c @@ -941,9 +941,13 @@ int parse_identifier_vl (const char *str, value_list_t *vl) /* {{{ */ sstrncpy (vl->host, host, sizeof (host)); sstrncpy (vl->plugin, plugin, sizeof (plugin)); - sstrncpy (vl->plugin_instance, plugin_instance, sizeof (plugin_instance)); + sstrncpy (vl->plugin_instance, + (plugin_instance != NULL) ? plugin_instance : "", + sizeof (plugin_instance)); sstrncpy (vl->type, type, sizeof (type)); - sstrncpy (vl->type_instance, type_instance, sizeof (type_instance)); + sstrncpy (vl->type_instance, + (type_instance != NULL) ? type_instance : "", + sizeof (type_instance)); return (0); } /* }}} int parse_identifier_vl */