From f8edb74439c0b536fe6bbc3a92e86670b414de37 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Mon, 28 Dec 2009 11:04:07 +0530 Subject: [PATCH] double port/address negation is parsed incorrectly --- src/detect-engine-port.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/detect-engine-port.c b/src/detect-engine-port.c index afb31c0d34..5be1120581 100644 --- a/src/detect-engine-port.c +++ b/src/detect-engine-port.c @@ -2454,6 +2454,19 @@ int PortTestMatchReal19() return PortTestMatchRealWrp(sig, 1); } +static int PortTestMatchDoubleNegation(void) +{ + int result = 0; + DetectPort *head = NULL, *nhead = NULL; + + if (DetectPortParseDo(&head, &nhead, "![!80]", 0) == -1) + return result; + + result = (head != NULL); + result = (nhead == NULL); + + return result; +} #endif /* UNITTESTS */ @@ -2499,6 +2512,9 @@ void DetectPortTests(void) { UtRegisterTest("PortTestMatchReal18", PortTestMatchReal18, 1); UtRegisterTest("PortTestMatchReal19 (expected to fail, see bug #8)", PortTestMatchReal19, 1); + UtRegisterTest("PortTestMatchDoubleNegation", PortTestMatchDoubleNegation, 1); + + #endif /* UNITTESTS */ }