"valid", args[1]);
goto error;
}
- if ((strcmp(args[0], ">")) == 0) icd->mode = DETECT_ICODE_GT;
- else icd->mode = DETECT_ICODE_LT;
+ if ((strcmp(args[0], ">")) == 0) {
+ if (icd->code1 == 255) {
+ SCLogError(SC_ERR_INVALID_ARGUMENT,
+ "specified icmp code >%s is not "
+ "valid",
+ args[1]);
+ goto error;
+ }
+ icd->mode = DETECT_ICODE_GT;
+ } else {
+ if (icd->code1 == 0) {
+ SCLogError(SC_ERR_INVALID_ARGUMENT,
+ "specified icmp code <%s is not "
+ "valid",
+ args[1]);
+ goto error;
+ }
+ icd->mode = DETECT_ICODE_LT;
+ }
} else { /* no "<", ">" */
/* we have a range ("<>") */
if (args[2] != NULL) {
UtRegisterTest("DetectICodeParseTest08", DetectICodeParseTest08);
UtRegisterTest("DetectICodeMatchTest01", DetectICodeMatchTest01);
}
-#endif /* UNITTESTS */
\ No newline at end of file
+#endif /* UNITTESTS */
"valid", args[1]);
goto error;
}
- if ((strcmp(args[0], ">")) == 0) itd->mode = DETECT_ITYPE_GT;
- else itd->mode = DETECT_ITYPE_LT;
+ if ((strcmp(args[0], ">")) == 0) {
+ if (itd->type1 == 255) {
+ SCLogError(SC_ERR_INVALID_ARGUMENT,
+ "specified icmp type >%s is not "
+ "valid",
+ args[1]);
+ goto error;
+ }
+ itd->mode = DETECT_ITYPE_GT;
+ } else {
+ if (itd->type1 == 0) {
+ SCLogError(SC_ERR_INVALID_ARGUMENT,
+ "specified icmp type <%s is not "
+ "valid",
+ args[1]);
+ goto error;
+ }
+ itd->mode = DETECT_ITYPE_LT;
+ }
} else { /* no "<", ">" */
/* we have a range ("<>") */
if (args[2] != NULL) {
UtRegisterTest("DetectITypeParseTest08", DetectITypeParseTest08);
UtRegisterTest("DetectITypeMatchTest01", DetectITypeMatchTest01);
}
-#endif /* UNITTESTS */
\ No newline at end of file
+#endif /* UNITTESTS */