-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Be careful with snprintf #222
Be careful with snprintf #222
Conversation
I have it on my to-do list today to land unit tests for this facility. Would you be OK pending this until I land that PR? |
does the unit test framework support mocking or handle exceptions (crashes)? |
Probably a longer conversation, but maybe. When you do 'make check' the build system framework will treat a crash as a fail and log it as such. If you are using the super-simple-it-runs-on-bare-metal-devices nl-unit-test framework, it doesn't catch exceptions or handle backtraces or anything of the sort. A crash will crash the program. You could make arguments one way or another whether this is good or bad. But, in our world, whether it's a Linux-class device or a bare-metal-class RTOS device, we have a unit test image that gets loaded and the unit tests run, with the same core framework and the same unit tests, on device. In short, there was more value to having one thing that ran everywhere (on target and on build host as well as Linux- and bare-metal-class) than having something fancier and runtime and platform-specific. |
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.
ok
@gerickson this got merged before any tests were imported. Are there tests that still need to come in or should I be adding those to what you've landed for this directory? |
I added these from openweave-core but they are arguably not proper unit tests and could stand improvement. |
…r neighborhood discovery protocol (project-chip#23105)" from silabs to silabs_1.0 Merge in WMN_TOOLS/matter from cherry-pick/add-lwip-ipv6-mld-support-new to silabs_1.0 Squashed commit of the following: commit 61fdbeb2b50a67a05ed27de87ed052453d9bfe5e Author: Rohan Sahay <103027015+rosahay-silabs@users.noreply.github.com> Date: Tue Oct 11 19:51:03 2022 +0530 [EFR32] Adds lwip ipv6 MLD support for neighborhood discovery protocol (project-chip#23105) * Adds LWIP_IPV6_MLD support for Neighborhood discovery * Adds temporary fix for NS loopback issue
…D support for neighborhood discovery protocol (project-chip#23105)" from silabs to silabs_1.0 Merge in WMN_TOOLS/matter from cherry-pick/add-lwip-ipv6-mld-support-new to silabs_1.0 Squashed commit of the following: commit 61fdbeb2b50a67a05ed27de87ed052453d9bfe5e Author: Rohan Sahay <103027015+rosahay-silabs@users.noreply.github.com> Date: Tue Oct 11 19:51:03 2022 +0530 [EFR32] Adds lwip ipv6 MLD support for neighborhood discovery protocol (project-chip#23105) * Adds LWIP_IPV6_MLD support for Neighborhood discovery * Adds temporary fix for NS loopback issue
Problem
ErrStr puts too much stock in snprintf's behavior and return value,
and may as a result may index outside the bounds of the output buffer
consider:
http://www.cplusplus.com/reference/cstdio/snprintf/
http://www.cplusplus.com/reference/cstdio/snprintf/
Summary of Changes
restructure to be able to safely ignore sprintf's return value