[monitoring-plugins] check_snmp: Segfault if number of processed lines ...

GitHub git at monitoring-plugins.org
Sun Jul 24 16:50:10 CEST 2022


    Module: monitoring-plugins
    Branch: master
    Commit: 9f2a9ca3d72023ff9b5707d1872c54d65edc9017
    Author: adrb <github.adrb at adrb.pl>
 Committer: GitHub <noreply at github.com>
      Date: Sun Jul 24 16:44:16 2022 +0200
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=9f2a9ca

check_snmp: Segfault if number of processed lines is greater than number of thresholds

Segfault at line 489 if number of processed lines is greater than number (#1589) of thresholds

Co-authored-by: Lorenz <12514511+RincewindsHat at users.noreply.github.com>

---

 plugins/check_snmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index bd13e57..2601ccd 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -376,7 +376,7 @@ main (int argc, char **argv)
 		}
 	}
 
-	for (line=0, i=0; line < chld_out.lines; line++, i++) {
+	for (line=0, i=0; line < chld_out.lines && i < numoids ; line++, i++) {
 		if(calculate_rate)
 			conv = "%.10g";
 		else



More information about the Commits mailing list