From 89e3d92cdb3952e93e8c8429abb99fc7bf1a985c Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Wed, 7 Jul 2010 13:19:07 +0530 Subject: [PATCH] fix creating a static array of length 0 in SigMatchGetLastSMFromLists - clang fix --- src/detect-parse.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/detect-parse.c b/src/detect-parse.c index 201d75f7ce..54ceddba3f 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -459,10 +459,11 @@ SigMatch *SigMatchGetLastSM(SigMatch *sm, uint8_t type) SigMatch *SigMatchGetLastSMFromLists(Signature *s, int args, ...) { - if (args % 2 != 0) { + if (args == 0 || args % 2 != 0) { SCLogError(SC_ERR_INVALID_ARGUMENTS, "You need to send an even no of args " - "to this function, since we need a SigMatch list for every " - "SigMatch type(send a map of sm_type and sm_list) sent"); + "(non zero as well) to this function, since we need a " + "SigMatch list for every SigMatch type(send a map of sm_type " + "and sm_list) sent"); return NULL; } @@ -487,6 +488,9 @@ SigMatch *SigMatchGetLastSMFromLists(Signature *s, int args, ...) va_end(ap); + if (list_index == 0) + return NULL; + SigMatch *sm[list_index]; int sm_entries = 0; for (i = 0; i < list_index; i++) {