This patch fixes 2 bugs:

 . Crash when -H specified multiple times;
 . Crash when -H specified zero times;

It doesn't fix the parsing problem when -l is specified for a drive
that doesn't exist.
diff -u nagios-plugins-1.4.12/debian/changelog 
nagios-plugins-1.4.12/debian/changelog
--- nagios-plugins-1.4.12.orig/plugins/check_nt.c
+++ nagios-plugins-1.4.12/plugins/check_nt.c
@@ -134,6 +134,11 @@
        /* set socket timeout */
        alarm(socket_timeout);
 
+       if (NULL==server_address) {
+               fputs("missing -H parameter\n", stderr);
+               exit(return_code);
+       }
+
        switch (vars_to_check) {
 
        case CHECK_CLIENTVERSION:
@@ -517,7 +522,6 @@
                                print_revision(progname,revision);
                                exit(STATE_OK);
                        case 'H': /* hostname */
-                               if (server_address)     free(server_address);
                                server_address = optarg;
                                break;
                        case 's': /* password */

Reply via email to