stream_size operator comparison (fix issue #1488)

`DetectStreamSizeParse` was first checking if mode[0] is '<', which is true for both '<' and '<=', thus '<=' (and resp. '>=') is never matched. This patch does the `strcmp` to '<=' (resp. '>=') within the if block of '<' (resp. '>') to fix #1488.
pull/1580/head
Zopieux 10 years ago committed by Victor Julien
parent 45fc619f79
commit cd038419fd

@ -244,19 +244,19 @@ DetectStreamSizeData *DetectStreamSizeParse (char *streamstr)
if (strlen(mode) == 0)
goto error;
if (mode[0] == '<')
if (mode[0] == '=') {
sd->mode = DETECTSSIZE_EQ;
} else if (mode[0] == '<') {
sd->mode = DETECTSSIZE_LT;
else if (strcmp("<=", mode) == 0)
sd->mode = DETECTSSIZE_LEQ;
else if (mode[0] == '>')
if (strcmp("<=", mode) == 0)
sd->mode = DETECTSSIZE_LEQ;
} else if (mode[0] == '>') {
sd->mode = DETECTSSIZE_GT;
else if (strcmp(">=", mode) == 0)
sd->mode = DETECTSSIZE_GEQ;
else if (strcmp("!=", mode) == 0)
if (strcmp(">=", mode) == 0)
sd->mode = DETECTSSIZE_GEQ;
} else if (strcmp("!=", mode) == 0) {
sd->mode = DETECTSSIZE_NEQ;
else if (mode[0] == '=')
sd->mode = DETECTSSIZE_EQ;
else {
} else {
SCLogError(SC_ERR_INVALID_OPERATOR, "Invalid operator");
goto error;
}

Loading…
Cancel
Save