From: Sebastian Harl Date: Thu, 27 Sep 2007 10:25:14 +0000 (+0200) Subject: perl plugin: Fixed a possible buffer overflow in get_module_name(). X-Git-Tag: collectd-4.0.9~4 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=930d01e4400ef87372eefa2b92f385d34d527c90;p=collectd.git perl plugin: Fixed a possible buffer overflow in get_module_name(). A '\0' might have been written above the buffer array bounds. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/src/perl.c b/src/perl.c index 1ad72487..f2cb7b66 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 */