[collectd] [PATCH] perl plugin: Fixed a possible buffer overflow in get_module_name().

Sebastian Harl sh at tokkee.org
Thu Sep 27 12:25:14 CEST 2007


A '\0' might have been written above the buffer array bounds.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/perl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/perl.c b/src/perl.c
index 1ad7248..f2cb7b6 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -333,7 +333,7 @@ static char *get_module_name (char *buf, size_t buf_len, const char *module) {
 		status = snprintf (buf, buf_len, "%s::%s", base_name, module);
 	if ((status < 0) || (status >= buf_len))
 		return (NULL);
-	buf[buf_len] = '\0';
+	buf[buf_len - 1] = '\0';
 	return (buf);
 } /* char *get_module_name */
 
-- 
1.5.2.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20070927/6801692c/attachment.pgp 


More information about the collectd mailing list