From 783c78130182253fe296fb1e4117f4b900ad9dd0 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 27 May 2011 10:39:46 +0200 Subject: [PATCH] Fix potential crash in address parsing code. --- src/detect-engine-address.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/detect-engine-address.c b/src/detect-engine-address.c index dfa12842e9..70ff6bb34e 100644 --- a/src/detect-engine-address.c +++ b/src/detect-engine-address.c @@ -389,7 +389,7 @@ int DetectAddressInsert(DetectEngineCtx *de_ctx, DetectAddressHead *gh, DetectAddress *new) { DetectAddress *head = NULL; - DetectPort *port = new->port; + DetectPort *port = NULL; DetectAddress *cur = NULL; DetectAddress *c = NULL; int r = 0; @@ -397,6 +397,8 @@ int DetectAddressInsert(DetectEngineCtx *de_ctx, DetectAddressHead *gh, if (new == NULL) return 0; + port = new->port; + BUG_ON(new->ip.family == 0 && !(new->flags & ADDRESS_FLAG_ANY)); /* get our head ptr based on the address we want to insert */