aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorGravatar Subhendu Ghosh <sghosh@users.sourceforge.net> 2002-11-15 17:47:03 +0000
committerGravatar Subhendu Ghosh <sghosh@users.sourceforge.net> 2002-11-15 17:47:03 +0000
commit963a75e0088f60bff86344928b3b093ded09b70b (patch)
treec0f3736e19d138d860fad74912a1b0fa874484ec /plugins/check_snmp.c
parente9cb56335f1a7058ec78c0c42f67d0c1c5d50585 (diff)
downloadmonitoring-plugins-963a75e0088f60bff86344928b3b093ded09b70b.tar.gz
memory bounds in options, no output comparison case
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@204 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 36a33270..fc191201 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -356,13 +356,14 @@ main (int argc, char **argv)
exit (STATE_UNKNOWN);
#endif
}
-
- if (response && iresult == STATE_DEPENDENT)
- iresult = STATE_OK;
- else if (eval_method[i] & CRIT_PRESENT)
- iresult = STATE_CRITICAL;
- else if (eval_method[i] & WARN_PRESENT)
- iresult = STATE_WARNING;
+ else {
+ if (response && iresult == STATE_DEPENDENT)
+ iresult = STATE_OK;
+ else if (eval_method[i] & CRIT_PRESENT)
+ iresult = STATE_CRITICAL;
+ else if (eval_method[i] & WARN_PRESENT)
+ iresult = STATE_WARNING;
+ }
result = max_state (result, iresult);
@@ -549,7 +550,7 @@ process_arguments (int argc, char **argv)
case 's': /* string or substring */
strncpy (string_value, optarg, sizeof (string_value) - 1);
string_value[sizeof (string_value) - 1] = 0;
- eval_method[jj++] = CRIT_STRING;
+ eval_method[jj] = CRIT_STRING;
break;
case 'R': /* regex */
#ifdef HAVE_REGEX_H
@@ -566,7 +567,7 @@ process_arguments (int argc, char **argv)
printf ("Could Not Compile Regular Expression");
return ERROR;
}
- eval_method[jj++] = CRIT_REGEX;
+ eval_method[jj] = CRIT_REGEX;
#else
printf ("SNMP UNKNOWN: call for regex which was not a compiled option");
exit (STATE_UNKNOWN);