summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2021-07-25 18:49:06 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2021-07-25 18:49:06 +0200
commitde5503063e4ea455a7a0a57afcc467a2041c859f (patch)
treec9d3e7c8d36fcc5d827b82877775ad5391fc2244
parent3f5c54c7830b0529030bb08e2c333497e70b6eb1 (diff)
downloadmonitoring-plugins-de5503063e4ea455a7a0a57afcc467a2041c859f.tar.gz
check_curl: fixed a potential buffer overflow in retir/uri_string
-rw-r--r--plugins/check_curl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 2c91a275..5990b95b 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -1033,8 +1033,8 @@ char*
1033uri_string (const UriTextRangeA range, char* buf, size_t buflen) 1033uri_string (const UriTextRangeA range, char* buf, size_t buflen)
1034{ 1034{
1035 if (!range.first) return "(null)"; 1035 if (!range.first) return "(null)";
1036 strncpy (buf, range.first, max (buflen, range.afterLast - range.first)); 1036 strncpy (buf, range.first, max (buflen-1, range.afterLast - range.first));
1037 buf[max (buflen, range.afterLast - range.first)] = '\0'; 1037 buf[max (buflen-1, range.afterLast - range.first)] = '\0';
1038 buf[range.afterLast - range.first] = '\0'; 1038 buf[range.afterLast - range.first] = '\0';
1039 return buf; 1039 return buf;
1040} 1040}