Fix typo in uricontent within handling causing within to be wrong.

remotes/origin/master-1.0.x
Victor Julien 15 years ago
parent cc5c78dae9
commit 26ef58342d

@ -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;
}

@ -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;
}
}

Loading…
Cancel
Save