util/var: add NULL check in VarNameStoreRegister

And check return value in entropy keyword setup

(cherry picked from commit 854201703e)
pull/14213/head
Philippe Antoine 6 months ago committed by Victor Julien
parent c935f08cd9
commit 02ef2655f9

@ -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