detect: debug validation for list ids overflows

pull/6324/head
Philippe Antoine 4 years ago committed by Victor Julien
parent 86681c9d7c
commit bbbb816ed6

@ -115,6 +115,7 @@ void DetectAppLayerMpmRegister2(const char *name,
am->name = name;
snprintf(am->pname, sizeof(am->pname), "%s", am->name);
am->direction = direction;
DEBUG_VALIDATE_BUG_ON(sm_list < 0 || sm_list > INT16_MAX);
am->sm_list = sm_list;
am->sm_list_base = sm_list;
am->priority = priority;
@ -155,6 +156,7 @@ void DetectAppLayerMpmRegisterByParentId(DetectEngineCtx *de_ctx,
BUG_ON(am == NULL);
am->name = t->name;
am->direction = t->direction;
DEBUG_VALIDATE_BUG_ON(id < 0 || id > INT16_MAX);
am->sm_list = id; // use new id
am->sm_list_base = t->sm_list;
am->type = DETECT_BUFFER_MPM_TYPE_APP;
@ -314,6 +316,7 @@ void DetectPktMpmRegister(const char *name,
BUG_ON(am == NULL);
am->name = name;
snprintf(am->pname, sizeof(am->pname), "%s", am->name);
DEBUG_VALIDATE_BUG_ON(sm_list < 0 || sm_list > INT16_MAX);
am->sm_list = sm_list;
am->priority = priority;
am->type = DETECT_BUFFER_MPM_TYPE_PKT;
@ -351,6 +354,7 @@ void DetectPktMpmRegisterByParentId(DetectEngineCtx *de_ctx,
BUG_ON(am == NULL);
am->name = t->name;
snprintf(am->pname, sizeof(am->pname), "%s#%d", am->name, id);
DEBUG_VALIDATE_BUG_ON(id < 0 || id > INT16_MAX);
am->sm_list = id; // use new id
am->sm_list_base = t->sm_list;
am->type = DETECT_BUFFER_MPM_TYPE_PKT;

Loading…
Cancel
Save