-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: malloc checks at msc_tree #3427
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
Conversation
Also, maybe we need NULL check for ModSecurity/src/utils/msc_tree.cc Line 685 in 1ff9f2a
|
|
Hi @wooffie, thanks again for this PR. Honestly, I would avoid But of course, to apply these modifications, we have to review all occurrences and places where this structure is used, and align the code. I assume this change will disappear the SonarCloud quality issue (now you can see in check list that it's failed, because of the code complexity (with the new What do you think? |
Yes, no problem, I check, this is one of three files with using malloc in |
Thank you!
I think you can, but may be we have to review existing tests too. It seems like this classes and structures are used in There is a seclang-test file too, you can run that too. Let me know if you need any help! |
@airween we really need to save C-API for msc_tree.h ? |
Sorry, you mean you would rewrite that part and modernize the code? If yes, I think that would be awesome! Btw I think these two files are legacy from mod_security2 code base (which is pure C source), see msc_tree.h and msc_tree.c, this is why this part is in C (too - like many others). |
I'm about C-compat with extern "C" linking for this header file. I think we should rewrite in without C. I will start to work around, but can't say when back with some enhancements |
But this header is not accessible through (library's) C-API, only library's components access them.
Agree.
No problem, as I wrote, it's a legacy and we've been using it for about 8 years or so :) |
I close this one, |
what
why
Avoid NPD
references
Some more info: #2890
P.S. Maybe at 419 we should return something another?