diff --git a/src/detect-uricontent.c b/src/detect-uricontent.c index 6305e67dac..7b84c77efe 100644 --- a/src/detect-uricontent.c +++ b/src/detect-uricontent.c @@ -1147,17 +1147,24 @@ static int DetectUriSigTest04(void) { if (s == NULL) { printf("sig 10 failed to parse: "); goto end; - } else if (s->umatch == NULL || - s->pmatch == NULL || - ((DetectContentData*) s->pmatch->ctx)->depth != 10 || + } + + if (s->umatch == NULL || s->pmatch == NULL) { + printf("umatch %p or pmatch %p: ", s->umatch, s->pmatch); + goto end; + } + + if ( ((DetectContentData*) s->pmatch->ctx)->depth != 10 || ((DetectContentData*) s->pmatch->ctx)->offset != 5 || - ((DetectContentData*) s->umatch_tail->ctx)->distance != 30 || - ((DetectContentData*) s->umatch_tail->ctx)->within != 60 || + ((DetectUricontentData*) s->umatch_tail->ctx)->distance != 30 || + ((DetectUricontentData*) s->umatch_tail->ctx)->within != 60 || ((DetectContentData*) s->pmatch_tail->ctx)->distance != 45 || ((DetectContentData*) s->pmatch_tail->ctx)->within != 70 || s->match != NULL) { printf("sig 10 failed to parse, content not setup properly: "); + DetectContentPrint((DetectContentData*) s->pmatch->ctx); DetectUricontentPrint((DetectUricontentData*) s->umatch_tail->ctx); + DetectContentPrint((DetectContentData*) s->pmatch_tail->ctx); goto end; } diff --git a/src/detect-within.c b/src/detect-within.c index df61c13267..7d24aaa267 100644 --- a/src/detect-within.c +++ b/src/detect-within.c @@ -100,7 +100,7 @@ static int DetectWithinSetup (DetectEngineCtx *de_ctx, Signature *s, char *withi ud->flags |= DETECT_URICONTENT_WITHIN; if (ud->flags & DETECT_URICONTENT_DISTANCE) { - if ((ud->distance + ud->uricontent_len) + ud->within) { + if ((ud->distance + ud->uricontent_len) > ud->within) { ud->within = ud->distance + ud->uricontent_len; } }