Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output/email: use SCCalloc for OutputJsonEmailCtx #9554

Closed
wants to merge 1 commit into from

Conversation

inashivb
Copy link
Member

@inashivb inashivb commented Oct 5, 2023

Link to redmine ticket: https://redmine.openinfosecfoundation.org/issues/6380

Previous PR: #9548

Changes since v2:

  • update commit message

email_ctx->fields only gets populated when smtp.custom setting is on.
The fn EveEmailLogJSONCustom is called when either
1. smtp.extended setting is on or,
2. email_ctx->fields is populated which means smtp.custom setting is on

In case neither of these are set in suricata.yaml, no call should
ideally be made to the fn EveEmailLogJSONCustom.
However, it turns out that email_ctx->fields is unset and then set only
after the smtp config was found. This leads to email_ctx->fields
sometimes contain value even when no config was given to the smtp
section and can lead to unexpected output.

Fix this by using SCCalloc while initializing OutputJsonEmailCtx struct
instead of SCMalloc.

Bug 6380
@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

Merging #9554 (dfabb07) into master (bb15a8f) will decrease coverage by 0.02%.
Report is 4 commits behind head on master.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9554      +/-   ##
==========================================
- Coverage   82.19%   82.18%   -0.02%     
==========================================
  Files         968      968              
  Lines      274216   274275      +59     
==========================================
+ Hits       225405   225421      +16     
- Misses      48811    48854      +43     
Flag Coverage Δ
fuzzcorpus 64.05% <100.00%> (-0.02%) ⬇️
suricata-verify 60.90% <100.00%> (-0.03%) ⬇️
unittests 62.87% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@victorjulien
Copy link
Member

Merged in #9575, thanks!

@inashivb inashivb deleted the smtp-email-logging/v3 branch October 16, 2023 09:45
@inashivb inashivb restored the smtp-email-logging/v3 branch November 22, 2023 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants