From 690a85698f06a24135d5ea14408e73c958fad795 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 19 Sep 2014 13:38:47 +0200 Subject: [PATCH] rule parser: fix crashing on malformed options Fix crashing on malformed rule options like 'rev;1;'. Bug 1254. --- src/detect-parse.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/detect-parse.c b/src/detect-parse.c index e1a9b3026d..1a5d683b25 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -552,6 +552,14 @@ static int SigParseOptions(DetectEngineCtx *de_ctx, Signature *s, char *optstr, } } + if (!(st->flags & SIGMATCH_NOOPT)) { + if (strlen(optvalue) == 0) { + SCLogError(SC_ERR_INVALID_SIGNATURE, "invalid formatting or malformed option to %s keyword: \'%s\'", + optname, optstr); + goto error; + } + } + /* setup may or may not add a new SigMatch to the list */ if (st->Setup(de_ctx, s, strlen(optvalue) ? optvalue : NULL) < 0) { SCLogDebug("\"%s\" failed to setup", st->name);