[monitoring-plugins] Simply initializes n before it is used

Jan Wagner git at monitoring-plugins.org
Sun Jan 20 20:20:15 CET 2019


    Module: monitoring-plugins
    Branch: maint-2.2
    Commit: eeb41ef1e7f687585aa34be8c655848a4fe647e4
    Author: Iustin Pop <iustin at debian.org>
 Committer: Jan Wagner <waja at cyconet.org>
      Date: Fri Jan 18 22:52:54 2019 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=eeb41ef

Simply initializes n before it is used

When SSL is enabled, n is assigned the size of the server's second EHLO
response (I think in bytes), which will usually be significantly higher
than the command passed. As such, no commands are executed and no responses
are checked, which - silently - defeats the desired checks and results in a
success value.

---

 plugins/check_smtp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 0fcf4c6..d37c57c 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -293,6 +293,7 @@ main (int argc, char **argv)
 		    printf("%s", buffer);
 		}
 
+		n = 0;
 		while (n < ncommands) {
 			xasprintf (&cmd_str, "%s%s", commands[n], "\r\n");
 			my_send(cmd_str, strlen(cmd_str));



More information about the Commits mailing list