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

yaml: Add check of allocation for node object #11822

Conversation

jtstrs
Copy link
Contributor

@jtstrs jtstrs commented Sep 23, 2024

Fix potential dereferece of nullptr in case of unsuccessful allocation
of memory for list node

Bug: #7270

Contribution style:

Our Contribution agreements:

Changes (if applicable):

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

Describe changes:

  • Add check of node pointers after allocation of memory;
  • If memory allocated successfully, behavior do not change;
  • If allocation fail, goto fail marker;

Copy link

codecov bot commented Sep 23, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.60%. Comparing base (7ab8334) to head (2799bd2).
Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11822      +/-   ##
==========================================
+ Coverage   82.58%   82.60%   +0.02%     
==========================================
  Files         914      914              
  Lines      249500   249502       +2     
==========================================
+ Hits       206045   206102      +57     
+ Misses      43455    43400      -55     
Flag Coverage Δ
fuzzcorpus 60.57% <50.00%> (+0.14%) ⬆️
livemode 18.72% <50.00%> (+<0.01%) ⬆️
pcap 44.09% <50.00%> (+0.02%) ⬆️
suricata-verify 62.02% <50.00%> (+<0.01%) ⬆️
unittests 58.96% <50.00%> (+<0.01%) ⬆️

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

@victorjulien victorjulien requested review from jasonish and removed request for victorjulien September 23, 2024 19:13
Copy link
Contributor

@catenacyber catenacyber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would like the ticket number in the commit message cf https://docs.suricata.io/en/latest/devguide/contributing/code-submission-process.html#commits

Also, I see some unit tests do not check it like ConfNode *parent = ConfNodeNew();

@catenacyber
Copy link
Contributor

Thanks for this report, how did you find it ?

@jtstrs
Copy link
Contributor Author

jtstrs commented Sep 30, 2024

Sure, will update it. This issue was found by some static analysis tools

@jufajardini
Copy link
Contributor

Sure, will update it. This issue was found by some static analysis tools

Nice, could you share which one?

@jufajardini
Copy link
Contributor

Replaced by: #11847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants