From: Victor Julien Date: Fri, 19 Sep 2014 11:38:47 +0000 (+0200) Subject: rule parser: fix crashing on malformed options X-Git-Tag: suricata-2.1beta2~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=690a85698f06a24135d5ea14408e73c958fad795;p=thirdparty%2Fsuricata.git rule parser: fix crashing on malformed options Fix crashing on malformed rule options like 'rev;1;'. Bug 1254. --- 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);