idmef_time_t *time;
idmef_alert_t *alert;
prelude_string_t *str;
- idmef_message_t *idmef;
+ idmef_message_t *idmef = NULL;
idmef_classification_t *class;
PacketAlert *pa;
SCReturnInt(TM_ECODE_OK);
err:
- idmef_message_destroy(idmef);
+ if (idmef != NULL)
+ idmef_message_destroy(idmef);
SCReturnInt(TM_ECODE_FAILED);
}
{
AppLayerProbingParser **probing_parsers = &ctx->probing_parsers;
AppLayerProbingParserElement *pe = NULL;
+ AppLayerProbingParserElement *new_pe = NULL;
AppLayerProbingParser *pp = NULL;
/* Add info about this probing parser to our database. Also detects any
/* \todo introduce parsing port range here */
/* Get a new parser element */
- AppLayerProbingParserElement *new_pe =
- AppLayerCreateAppLayerProbingParserElement(al_proto_name, ip_proto,
+ new_pe = AppLayerCreateAppLayerProbingParserElement(al_proto_name, ip_proto,
al_proto, min_depth,
max_depth, port,
priority, top,
SCPerfClubTMInst *temp = NULL;
pctmi = sc_perf_op_ctx->pctmi;
- if (sc_perf_op_ctx != NULL) {
- if (sc_perf_op_ctx->fp != NULL)
- fclose(sc_perf_op_ctx->fp);
+ if (sc_perf_op_ctx->fp != NULL)
+ fclose(sc_perf_op_ctx->fp);
- if (sc_perf_op_ctx->file != NULL)
- SCFree(sc_perf_op_ctx->file);
+ if (sc_perf_op_ctx->file != NULL)
+ SCFree(sc_perf_op_ctx->file);
- while (pctmi != NULL) {
- if (pctmi->tm_name != NULL)
- SCFree(pctmi->tm_name);
+ while (pctmi != NULL) {
+ if (pctmi->tm_name != NULL)
+ SCFree(pctmi->tm_name);
- if (pctmi->head != NULL)
- SCFree(pctmi->head);
+ if (pctmi->head != NULL)
+ SCFree(pctmi->head);
- temp = pctmi->next;
- SCFree(pctmi);
- pctmi = temp;
- }
-
- SCFree(sc_perf_op_ctx);
+ temp = pctmi->next;
+ SCFree(pctmi);
+ pctmi = temp;
}
+ SCFree(sc_perf_op_ctx);
+
return;
}
if (GRE_FLAG_ISSET_ROUTE(p->greh))
{
- gsre = (GRESreHdr *)(pkt + header_len);
- if (gsre == NULL)
- return;
-
while (1)
{
if ((header_len + GRE_SRE_HDR_LEN) > len) {
return;
}
+ gsre = (GRESreHdr *)(pkt + header_len);
+
header_len += GRE_SRE_HDR_LEN;
- if (gsre != NULL && (ntohs(gsre->af) == 0) && (gsre->sre_length == 0))
+ if ((ntohs(gsre->af) == 0) && (gsre->sre_length == 0))
break;
header_len += gsre->sre_length;
ENGINE_SET_EVENT(p, GRE_VERSION0_MALFORMED_SRE_HDR);
return;
}
-
- gsre = (GRESreHdr *)(pkt + header_len);
- if (gsre == NULL)
- return;
}
}
break;
static int DetectAddressIPv4TestAddressCmp01(void)
{
- DetectAddress *a = DetectAddressInit();
- DetectAddress *b = DetectAddressInit();
struct in_addr in;
int result = 1;
- if (a == NULL || b == NULL)
- goto error;
+ DetectAddress *a = DetectAddressInit();
+ if (a == NULL)
+ return 0;
+
+ DetectAddress *b = DetectAddressInit();
+ if (b == NULL) {
+ DetectAddressFree(a);
+ return 0;
+ }
if (inet_pton(AF_INET, "1.2.3.4", &in) < 0)
goto error;
b->ip2.addr_data32[0] = in.s_addr;
result &= (DetectAddressCmpIPv4(a, b) != ADDRESS_GT);
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
+ DetectAddressFree(b);
return result;
error:
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
+ DetectAddressFree(b);
return 0;
}
static int DetectAddressIPv4CutNot05(void)
{
DetectAddress *a = NULL;
- DetectAddress *b = NULL;
struct in_addr in;
int result = 1;
if ( (a = DetectAddressInit()) == NULL)
- goto error;
+ return 0;
if (inet_pton(AF_INET, "0.0.0.0", &in) < 0)
goto error;
a->ip2.addr_data32[0] = in.s_addr;
result &= (DetectAddressCutNotIPv4(a, &b) == -1);
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
return result;
error:
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
return 0;
}
static int DetectAddressIPv4CutNot06(void)
{
DetectAddress *a = NULL;
- DetectAddress *b = NULL;
struct in_addr in;
int result = 1;
if ( (a = DetectAddressInit()) == NULL)
- goto error;
+ return 0;
if (inet_pton(AF_INET, "0.0.0.0", &in) < 0)
goto error;
if (inet_pton(AF_INET, "255.255.255.255", &in) < 0)
goto error;
result &= (a->ip2.addr_data32[0] = in.s_addr);
- result &= (b == NULL);
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
return result;
error:
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
return 0;
}
static int DetectAddressIPv4CutNot07(void)
{
DetectAddress *a = NULL;
- DetectAddress *b = NULL;
struct in_addr in;
int result = 1;
if ( (a = DetectAddressInit()) == NULL)
- goto error;
+ return 0;
if (inet_pton(AF_INET, "1.2.3.4", &in) < 0)
goto error;
if (inet_pton(AF_INET, "1.2.3.3", &in) < 0)
goto error;
result &= (a->ip2.addr_data32[0] = in.s_addr);
- result &= (b == NULL);
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
return result;
error:
- if (a != NULL)
- DetectAddressFree(a);
- if (b != NULL)
- DetectAddressFree(b);
+ DetectAddressFree(a);
return 0;
}
int result = 1;
if ( (a = DetectAddressInit()) == NULL)
- goto error;
+ return 0;
if (inet_pton(AF_INET, "1.2.3.4", &in) < 0)
goto error;
goto error;
result &= (b->ip2.addr_data32[0] = in.s_addr);
- if (a != NULL)
- DetectAddressFree(a);
+ DetectAddressFree(a);
if (b != NULL)
DetectAddressFree(b);
return result;
error:
- if (a != NULL)
- DetectAddressFree(a);
+ DetectAddressFree(a);
if (b != NULL)
DetectAddressFree(b);
return 0;
int result = 1;
if ( (a = DetectAddressInit()) == NULL)
- goto error;
+ return 0;
if (inet_pton(AF_INET, "1.2.3.4", &in) < 0)
goto error;
goto error;
result &= (b->ip2.addr_data32[0] = in.s_addr);
- if (a != NULL)
- DetectAddressFree(a);
+ DetectAddressFree(a);
if (b != NULL)
DetectAddressFree(b);
return result;
error:
- if (a != NULL)
- DetectAddressFree(a);
+ DetectAddressFree(a);
if (b != NULL)
DetectAddressFree(b);
return 0;
static int DetectAddressIPv4Join10(void)
{
- DetectAddress *source = DetectAddressInit();
- DetectAddress *target = DetectAddressInit();
struct in_addr in;
int result = 1;
- if (source == NULL || target == NULL)
- goto error;
+ DetectAddress *source = DetectAddressInit();
+ if (source == NULL)
+ return 0;
+
+ DetectAddress *target = DetectAddressInit();
+ if (target == NULL) {
+ DetectAddressFree(source);
+ return 0;
+ }
if (inet_pton(AF_INET, "128.51.61.124", &in) < 0)
goto error;
goto error;
result &= (target->ip2.addr_data32[0] == in.s_addr);
- if (source != NULL)
- DetectAddressFree(source);
- if (target != NULL)
- DetectAddressFree(target);
+ DetectAddressFree(source);
+ DetectAddressFree(target);
return result;
error:
- if (source != NULL)
- DetectAddressFree(source);
- if (target != NULL)
- DetectAddressFree(target);
+ DetectAddressFree(source);
+ DetectAddressFree(target);
return 0;
}
SCSigSignatureWrapper *max = NULL;
SCSigSignatureWrapper *prev = NULL;
+ if (sw == NULL)
+ return;
+
if (de_ctx->sc_sig_sig_wrapper == NULL) {
de_ctx->sc_sig_sig_wrapper = sw;
sw->min = NULL;
}
/* set the min signature for this keyword, for the next ordering function */
- if (sw == NULL)
- return;
min = sw;
while (min != NULL && min != sw->min) {
if (min->sig->action != sw->sig->action)
sw->min = min;
/* set the max signature for this keyword + 1, for the next ordering func */
- if (sw == NULL)
- return;
max = sw;
while (max != NULL && max != sw->max) {
if (max->sig->action != sw->sig->action)
SCSigSignatureWrapper *max = NULL;
SCSigSignatureWrapper *prev = NULL;
+ if (sw == NULL)
+ return;
+
if (de_ctx->sc_sig_sig_wrapper == NULL) {
de_ctx->sc_sig_sig_wrapper = sw;
sw->min = NULL;
}
/* set the min signature for this keyword, for the next ordering function */
- if (sw == NULL)
- return;
min = sw;
while (min != NULL && min != sw->min) {
if ( *((int *)(sw->user[SC_RADIX_USER_DATA_FLOWBITS])) !=
sw->min = min;
/* set the max signature for this keyword + 1, for the next ordering func */
- if (sw == NULL)
- return;
max = sw;
while (max!= NULL && max != sw->max) {
if ( *((int *)(sw->user[SC_RADIX_USER_DATA_FLOWBITS])) !=
SCSigSignatureWrapper *max = NULL;
SCSigSignatureWrapper *prev = NULL;
+ if (sw == NULL)
+ return;
+
if (de_ctx->sc_sig_sig_wrapper == NULL) {
de_ctx->sc_sig_sig_wrapper = sw;
sw->min = NULL;
}
/* set the min signature for this keyword, for the next ordering function */
- if (sw == NULL)
- return;
min = sw;
while (min != NULL && min != sw->min) {
if ( *((int *)(sw->user[SC_RADIX_USER_DATA_FLOWVAR])) !=
sw->min = min;
/* set the max signature for this keyword + 1, for the next ordering func */
- if (sw == NULL)
- return;
max = sw;
while (max != NULL && max != sw->max) {
if ( *((int *)(sw->user[SC_RADIX_USER_DATA_FLOWVAR])) !=
SCSigSignatureWrapper *max = NULL;
SCSigSignatureWrapper *prev = NULL;
+ if (sw == NULL)
+ return;
+
if (de_ctx->sc_sig_sig_wrapper == NULL) {
de_ctx->sc_sig_sig_wrapper = sw;
sw->min = NULL;
}
/* set the min signature for this keyword, for the next ordering function */
- if (sw == NULL)
- return;
-
min = sw;
while (min != NULL && min != sw->min) {
if ( *((int *)(sw->user[SC_RADIX_USER_DATA_PKTVAR])) !=
sw->min = min;
/* set the max signature for this keyword + 1, for the next ordering func */
- if (sw == NULL)
- return;
max = sw;
while (max != NULL && max != sw->max) {
if ( *((int *)(sw->user[SC_RADIX_USER_DATA_PKTVAR])) !=
SCSigSignatureWrapper *max = NULL;
SCSigSignatureWrapper *prev = NULL;
+ if (sw == NULL)
+ return;
+
if (de_ctx->sc_sig_sig_wrapper == NULL) {
de_ctx->sc_sig_sig_wrapper = sw;
sw->min = NULL;
}
/* set the min signature for this keyword, for the next ordering function */
- if (sw == NULL)
- return;
-
min = sw;
while (min != NULL && min != sw->min) {
if (min->sig->prio != sw->sig->prio)
sw->min = min;
/* set the max signature for this keyword + 1, for the next ordering func */
- if (sw == NULL)
- return;
-
max = sw;
while (max != NULL && max != sw->max) {
if (max->sig->prio != sw->sig->prio)
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_PMATCH];
DetectContentData *cd = sm->ctx;
- if (sm != NULL && sm->type == DETECT_CONTENT) {
+ if (sm->type == DETECT_CONTENT) {
if (cd->flags & DETECT_CONTENT_FAST_PATTERN &&
cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(cd->flags & cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_PMATCH];
DetectContentData *cd = sm->ctx;
- if (sm != NULL && sm->type == DETECT_CONTENT) {
+ if (sm->type == DETECT_CONTENT) {
if (cd->flags & DETECT_CONTENT_FAST_PATTERN &&
!(cd->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
cd->flags & cd->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_UMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL && sm->type == DETECT_URICONTENT) {
+ if (sm->type == DETECT_URICONTENT) {
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_UMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL && sm->type == DETECT_URICONTENT) {
+ if (sm->type == DETECT_URICONTENT) {
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_UMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL && sm->type == DETECT_URICONTENT) {
+ if (sm->type == DETECT_URICONTENT) {
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_UMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL && sm->type == DETECT_URICONTENT) {
+ if (sm->type == DETECT_URICONTENT) {
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HCBDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HCBDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HHDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HHDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HRHDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HRHDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HMDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HMDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HCDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HCDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HRUDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HRUDMATCH];
DetectContentData *ud = sm->ctx;
- if (sm != NULL) {
- if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
+ if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
- result = 1;
- } else {
- result = 0;
- }
+ result = 1;
+ } else {
+ result = 0;
}
end:
}
temp_sm = temp_sm->next;
}
- DetectIPProtoData *data_temp = temp_sm->ctx;
- if (data_temp->proto <= data->proto) {
- SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
- "both gt and lt ipprotos, with the lt being "
- "lower than gt value");
- goto error;
- /* Updated by AS. Please do not remove this unused code. Need it
- * as we redo this code once we solve ipproto multiple uses */
+ if (temp_sm != NULL) {
+ DetectIPProtoData *data_temp = temp_sm->ctx;
+ if (data_temp->proto <= data->proto) {
+ SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
+ "both gt and lt ipprotos, with the lt being "
+ "lower than gt value");
+ goto error;
+ /* Updated by AS. Please do not remove this unused code. Need it
+ * as we redo this code once we solve ipproto multiple uses */
#if 0
- s->proto.proto[data->proto / 8] |= 0xfe << (data->proto % 8);
- for (i = (data->proto / 8) + 1; i < (256 / 8); i++) {
- s->proto.proto[i] = 0xff;
- }
+ s->proto.proto[data->proto / 8] |= 0xfe << (data->proto % 8);
+ for (i = (data->proto / 8) + 1; i < (256 / 8); i++) {
+ s->proto.proto[i] = 0xff;
+ }
#endif
- } else {
- for (i = 0; i < (data->proto / 8); i++) {
- s->proto.proto[i] = 0;
- }
- s->proto.proto[data->proto / 8] &= 0xfe << (data->proto % 8);
- for (i = (data->proto / 8) + 1; i < (256 / 8); i++) {
- s->proto.proto[i] &= 0xff;
+ } else {
+ for (i = 0; i < (data->proto / 8); i++) {
+ s->proto.proto[i] = 0;
+ }
+ s->proto.proto[data->proto / 8] &= 0xfe << (data->proto % 8);
+ for (i = (data->proto / 8) + 1; i < (256 / 8); i++) {
+ s->proto.proto[i] &= 0xff;
+ }
}
}
} else if (!lt_set && not_set) {
}
temp_sm = temp_sm->next;
}
- data_temp = temp_sm->ctx;
- if (data_temp->proto <= data->proto) {
- /* Updated by AS. Please do not remove this unused code.
- * Need it as we redo this code once we solve ipproto
- * multiple uses */
- SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
- "both gt and lt ipprotos, with the lt being "
- "lower than gt value");
- goto error;
+ if (temp_sm != NULL) {
+ data_temp = temp_sm->ctx;
+ if (data_temp->proto <= data->proto) {
+ /* Updated by AS. Please do not remove this unused code.
+ * Need it as we redo this code once we solve ipproto
+ * multiple uses */
+ SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
+ "both gt and lt ipprotos, with the lt being "
+ "lower than gt value");
+ goto error;
#if 0
- s->proto.proto[data->proto / 8] |= 0xfe << (data->proto % 8);
- for (i = (data->proto / 8) + 1; i < (256 / 8); i++) {
- s->proto.proto[i] = 0xff;
- }
- temp_sm = s->sm_lists[DETECT_SM_LIST_MATCH];
- uint8_t *not_protos = NULL;
- int not_protos_len = 0;
- while (temp_sm != NULL) {
- if (temp_sm->type == DETECT_IPPROTO &&
- ((DetectIPProtoData *)temp_sm->ctx)->op == DETECT_IPPROTO_OP_NOT) {
- DetectIPProtoData *data_temp = temp_sm->ctx;
- not_protos = SCRealloc(not_protos,
- (not_protos_len + 1) * sizeof(uint8_t));
- if (not_protos == NULL)
- goto error;
- not_protos[not_protos_len] = data_temp->proto;
- not_protos_len++;
+ s->proto.proto[data->proto / 8] |= 0xfe << (data->proto % 8);
+ for (i = (data->proto / 8) + 1; i < (256 / 8); i++) {
+ s->proto.proto[i] = 0xff;
}
- temp_sm = temp_sm->next;
- }
- qsort(not_protos, not_protos_len, sizeof(uint8_t),
- DetectIPProtoQSortCompare);
- int j = 0;
- while (j < not_protos_len) {
- if (not_protos[j] < data->proto) {
- ;
- } else {
- s->proto.proto[not_protos[j] / 8] &= ~(1 << (not_protos[j] % 8));
+ temp_sm = s->sm_lists[DETECT_SM_LIST_MATCH];
+ uint8_t *not_protos = NULL;
+ int not_protos_len = 0;
+ while (temp_sm != NULL) {
+ if (temp_sm->type == DETECT_IPPROTO &&
+ ((DetectIPProtoData *)temp_sm->ctx)->op == DETECT_IPPROTO_OP_NOT) {
+ DetectIPProtoData *data_temp = temp_sm->ctx;
+ not_protos = SCRealloc(not_protos,
+ (not_protos_len + 1) * sizeof(uint8_t));
+ if (not_protos == NULL)
+ goto error;
+ not_protos[not_protos_len] = data_temp->proto;
+ not_protos_len++;
+ }
+ temp_sm = temp_sm->next;
+ }
+ qsort(not_protos, not_protos_len, sizeof(uint8_t),
+ DetectIPProtoQSortCompare);
+ int j = 0;
+ while (j < not_protos_len) {
+ if (not_protos[j] < data->proto) {
+ ;
+ } else {
+ s->proto.proto[not_protos[j] / 8] &= ~(1 << (not_protos[j] % 8));
+ }
+ j++;
}
- j++;
- }
#endif
+ }
} else {
for (i = 0; i < (data->proto / 8); i++) {
s->proto.proto[i] = 0;
}
temp_sm = temp_sm->next;
}
- DetectIPProtoData *data_temp = temp_sm->ctx;
- if (data_temp->proto >= data->proto) {
- /* Updated by AS. Please do not remove this unused code.
- * Need it as we redo this code once we solve ipproto
- * multiple uses */
- SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
- "both gt and lt ipprotos, with the lt being "
- "lower than gt value");
- goto error;
+ if (temp_sm != NULL) {
+ DetectIPProtoData *data_temp = temp_sm->ctx;
+ if (data_temp->proto >= data->proto) {
+ /* Updated by AS. Please do not remove this unused code.
+ * Need it as we redo this code once we solve ipproto
+ * multiple uses */
+ SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
+ "both gt and lt ipprotos, with the lt being "
+ "lower than gt value");
+ goto error;
#if 0
- for (i = 0; i < (data->proto / 8); i++) {
- s->proto.proto[i] = 0xff;
- }
- s->proto.proto[data->proto / 8] |= ~(0xff << (data->proto % 8));;
+ for (i = 0; i < (data->proto / 8); i++) {
+ s->proto.proto[i] = 0xff;
+ }
+ s->proto.proto[data->proto / 8] |= ~(0xff << (data->proto % 8));;
#endif
- } else {
- for (i = 0; i < (data->proto / 8); i++) {
- s->proto.proto[i] &= 0xff;
- }
- s->proto.proto[data->proto / 8] &= ~(0xff << (data->proto % 8));
- for (i = (data->proto / 8) + 1; i < 256 / 8; i++) {
- s->proto.proto[i] = 0;
+ } else {
+ for (i = 0; i < (data->proto / 8); i++) {
+ s->proto.proto[i] &= 0xff;
+ }
+ s->proto.proto[data->proto / 8] &= ~(0xff << (data->proto % 8));
+ for (i = (data->proto / 8) + 1; i < 256 / 8; i++) {
+ s->proto.proto[i] = 0;
+ }
}
}
} else if (!gt_set && not_set) {
}
temp_sm = temp_sm->next;
}
- data_temp = temp_sm->ctx;
- if (data_temp->proto >= data->proto) {
- /* Updated by AS. Please do not remove this unused code.
- * Need it as we redo this code once we solve ipproto
- * multiple uses */
- SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
- "both gt and lt ipprotos, with the lt being "
- "lower than gt value");
- goto error;
+ if (temp_sm != NULL) {
+ data_temp = temp_sm->ctx;
+ if (data_temp->proto >= data->proto) {
+ /* Updated by AS. Please do not remove this unused code.
+ * Need it as we redo this code once we solve ipproto
+ * multiple uses */
+ SCLogError(SC_ERR_INVALID_SIGNATURE, "We can't use a have "
+ "both gt and lt ipprotos, with the lt being "
+ "lower than gt value");
+ goto error;
#if 0
- for (i = 0; i < (data->proto / 8); i++) {
- s->proto.proto[i] = 0xff;
- }
- s->proto.proto[data->proto / 8] |= ~(0xff << (data->proto % 8));
- temp_sm = s->sm_lists[DETECT_SM_LIST_MATCH];
- uint8_t *not_protos = NULL;
- int not_protos_len = 0;
- while (temp_sm != NULL) {
- if (temp_sm->type == DETECT_IPPROTO &&
- ((DetectIPProtoData *)temp_sm->ctx)->op == DETECT_IPPROTO_OP_NOT) {
- DetectIPProtoData *data_temp = temp_sm->ctx;
- not_protos = SCRealloc(not_protos,
- (not_protos_len + 1) * sizeof(uint8_t));
- if (not_protos == NULL)
- goto error;
- not_protos[not_protos_len] = data_temp->proto;
- not_protos_len++;
+ for (i = 0; i < (data->proto / 8); i++) {
+ s->proto.proto[i] = 0xff;
}
- temp_sm = temp_sm->next;
- }
- qsort(not_protos, not_protos_len, sizeof(uint8_t),
- DetectIPProtoQSortCompare);
- int j = 0;
- while (j < not_protos_len) {
- if (not_protos[j] < data->proto) {
- s->proto.proto[not_protos[j] / 8] &= ~(1 << (not_protos[j] % 8));
- } else {
- ;
+ s->proto.proto[data->proto / 8] |= ~(0xff << (data->proto % 8));
+ temp_sm = s->sm_lists[DETECT_SM_LIST_MATCH];
+ uint8_t *not_protos = NULL;
+ int not_protos_len = 0;
+ while (temp_sm != NULL) {
+ if (temp_sm->type == DETECT_IPPROTO &&
+ ((DetectIPProtoData *)temp_sm->ctx)->op == DETECT_IPPROTO_OP_NOT) {
+ DetectIPProtoData *data_temp = temp_sm->ctx;
+ not_protos = SCRealloc(not_protos,
+ (not_protos_len + 1) * sizeof(uint8_t));
+ if (not_protos == NULL)
+ goto error;
+ not_protos[not_protos_len] = data_temp->proto;
+ not_protos_len++;
+ }
+ temp_sm = temp_sm->next;
+ }
+ qsort(not_protos, not_protos_len, sizeof(uint8_t),
+ DetectIPProtoQSortCompare);
+ int j = 0;
+ while (j < not_protos_len) {
+ if (not_protos[j] < data->proto) {
+ s->proto.proto[not_protos[j] / 8] &= ~(1 << (not_protos[j] % 8));
+ } else {
+ ;
+ }
+ j++;
}
- j++;
- }
#endif
+ }
} else {
for (i = 0; i < (data->proto / 8); i++) {
s->proto.proto[i] &= 0xFF;
*/
void *PoolTestAlloc(void *allocdata) {
- return SCMalloc(10);
+ void *ptr = SCMalloc(10);
+ return ptr;
}
void *PoolTestAllocArg(void *allocdata) {
size_t len = strlen((char *)allocdata) + 1;