-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[mdns] Added two nullptr checks to prevent falling into hard fault #24233
[mdns] Added two nullptr checks to prevent falling into hard fault #24233
Conversation
In mDNS code there isn't a check that would verify if memory was allocated successfully using new. In case it didn't the application will fall into hard fault due to usage of non-allocated memory. Added two checks verifying that memory was allocated successfully before using.
PR #24233: Size comparison from 9a1c31c to 574e46d Increases (29 builds for bl602, efr32, esp32, linux, mbed, nrfconnect, psoc6, telink)
Decreases (1 build for bl702)
Full report (53 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine, but will still crash the application, right? I guess at least the message will say why we crashed?
Yes, it would be better to change the API to make the method return some error code and handle it in the application. But for now I just wanted to crash the application in the controlled way instead of jumping into not allocated address in memory. |
In mDNS code there isn't a check that would verify if memory was allocated successfully using new. In case it didn't the application will fall into hard fault due to usage of non-allocated memory.
Added two checks verifying that memory was allocated successfully before using.