summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4dc9287)
raw | patch | inline | side by side (parent: 4dc9287)
author | Andres J. Diaz <ajdiaz@connectical.com> | |
Tue, 1 Mar 2011 16:25:21 +0000 (17:25 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 8 Mar 2011 08:42:44 +0000 (09:42 +0100) |
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 <ajdiaz@connectical.com>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
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 <ajdiaz@connectical.com>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
src/common.c | patch | blob | history |
diff --git a/src/common.c b/src/common.c
index 6fdb441c95af1ed952267d674e8d7f240f289dc5..7015c875f0fd9c664b99e6c19a54e9ff397f85fa 100644 (file)
--- a/src/common.c
+++ b/src/common.c
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 */