[monitoring-plugins] check_curl: fixed a potential buffer overflow in ...

Andreas Baumann git at monitoring-plugins.org
Sun Jul 25 18:50:11 CEST 2021


 Module: monitoring-plugins
 Branch: feature_check_curl
 Commit: de5503063e4ea455a7a0a57afcc467a2041c859f
 Author: Andreas Baumann <mail at andreasbaumann.cc>
   Date: Sun Jul 25 18:49:06 2021 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=de55030

check_curl: fixed a potential buffer overflow in retir/uri_string

---

 plugins/check_curl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 2c91a27..5990b95 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -1033,8 +1033,8 @@ char*
 uri_string (const UriTextRangeA range, char* buf, size_t buflen)
 {
   if (!range.first) return "(null)";
-  strncpy (buf, range.first, max (buflen, range.afterLast - range.first));
-  buf[max (buflen, range.afterLast - range.first)] = '\0';
+  strncpy (buf, range.first, max (buflen-1, range.afterLast - range.first));
+  buf[max (buflen-1, range.afterLast - range.first)] = '\0';
   buf[range.afterLast - range.first] = '\0';
   return buf;
 }



More information about the Commits mailing list