*** CID
1358024: Null pointer dereferences (REVERSE_INULL)
/src/util-mpm-hs.c: 1043 in SCHSPrintInfo()
1037 printf(" SCHSPattern %" PRIuMAX "\n", (uintmax_t)sizeof(SCHSPattern));
1038 printf("Unique Patterns: %" PRIu32 "\n", mpm_ctx->pattern_cnt);
1039 printf("Smallest: %" PRIu32 "\n", mpm_ctx->minlen);
1040 printf("Largest: %" PRIu32 "\n", mpm_ctx->maxlen);
1041 printf("\n");
1042
>>> CID
1358024: Null pointer dereferences (REVERSE_INULL)
>>> Null-checking "ctx" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1043 if (ctx) {
1044 char *db_info = NULL;
1045 if (hs_database_info(pd->hs_db, &db_info) == HS_SUCCESS) {
1046 printf("HS Database Info: %s\n", db_info);
1047 SCFree(db_info);
1048 }
void SCHSPrintInfo(MpmCtx *mpm_ctx)
{
SCHSCtx *ctx = (SCHSCtx *)mpm_ctx->ctx;
- PatternDatabase *pd = ctx->pattern_db;
printf("MPM HS Information:\n");
printf("Memory allocs: %" PRIu32 "\n", mpm_ctx->memory_cnt);
printf("\n");
if (ctx) {
+ PatternDatabase *pd = ctx->pattern_db;
char *db_info = NULL;
if (hs_database_info(pd->hs_db, &db_info) == HS_SUCCESS) {
printf("HS Database Info: %s\n", db_info);