[monitoring-plugins] fixed a wrong compare and a wrong size in strncat

Andreas Baumann git at monitoring-plugins.org
Wed Mar 8 16:40:11 CET 2023


 Module: monitoring-plugins
 Branch: curlfix1845
 Commit: fc927e98db73850e760f490117ed36f2de20270c
 Author: Andreas Baumann <mail at andreasbaumann.cc>
   Date: Wed Mar  8 16:10:45 2023 +0100
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=fc927e9

fixed a wrong compare and a wrong size in strncat

---

 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 512fb88..cc17ef5 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -422,8 +422,8 @@ lookup_host (const char *host, char *buf, size_t buflen)
     // Append all IPs to buf as a comma-separated string
     addrstr_len = strlen(addrstr);
     if (buflen_remaining > addrstr_len + 1) {
-      if (buf[0] != NULL) {
-        strncat(buf, ",", 1);
+      if (buf[0] != '\0') {
+        strncat(buf, ",", buflen_remaining);
         buflen_remaining -= 1;
       }
       strncat(buf, addrstr, buflen_remaining);



More information about the Commits mailing list