From 414723eda704326d47c203bcacfcb1bdc51eb784 Mon Sep 17 00:00:00 2001 From: "Andres J. Diaz" Date: Tue, 1 Mar 2011 17:25:21 +0100 Subject: [PATCH] Fix buffer length in parse_identifier_vl function. In parse_identifier_vl function (common.c), the value passed to sstrncpy as buffer length is the sizeof a char pointer, which is 4bytes for 32bit arch and 8bytes for 64 bit ones. This patch fix the length and truncate the buffer to the same size as destination buffer. Signed-off-by: Andres J. Diaz Signed-off-by: Florian Forster --- src/common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common.c b/src/common.c index 6fdb441c..7015c875 100644 --- a/src/common.c +++ b/src/common.c @@ -939,15 +939,15 @@ int parse_identifier_vl (const char *str, value_list_t *vl) /* {{{ */ if (status != 0) return (status); - sstrncpy (vl->host, host, sizeof (host)); - sstrncpy (vl->plugin, plugin, sizeof (plugin)); + sstrncpy (vl->host, host, sizeof (vl->host)); + sstrncpy (vl->plugin, plugin, sizeof (vl->plugin)); sstrncpy (vl->plugin_instance, (plugin_instance != NULL) ? plugin_instance : "", - sizeof (plugin_instance)); - sstrncpy (vl->type, type, sizeof (type)); + sizeof (vl->plugin_instance)); + sstrncpy (vl->type, type, sizeof (vl->type)); sstrncpy (vl->type_instance, (type_instance != NULL) ? type_instance : "", - sizeof (type_instance)); + sizeof (vl->type_instance)); return (0); } /* }}} int parse_identifier_vl */ -- 2.30.2