util/var: add NULL check in VarNameStoreRegister

And check return value in entropy keyword setup
pull/14202/head
Philippe Antoine 7 days ago committed by Victor Julien
parent 6d703af505
commit 854201703e

@ -56,6 +56,9 @@ static int DetectEntropySetup(DetectEngineCtx *de_ctx, Signature *s, const char
} else {
ded->fv_idx = VarNameStoreRegister("content", VAR_TYPE_FLOW_FLOAT);
}
if (ded->fv_idx == 0) {
goto error;
}
if (SCSigMatchAppendSMToList(de_ctx, s, DETECT_ENTROPY, (SigMatchCtx *)ded, sm_list) != NULL) {
SCReturnInt(0);

@ -154,6 +154,9 @@ void VarNameStoreDestroy(void)
*/
uint32_t VarNameStoreRegister(const char *name, const enum VarTypes type)
{
if (name == NULL) {
return 0;
}
SCMutexLock(&base_lock);
uint32_t id = 0;

Loading…
Cancel
Save