Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix code in CHIPCryptoPALOpenSSL that could try to log nullptr (#18105)
* Fix code in CHIPCryptoPALOpenSSL could try to log null - Some %s specifiers did not have a guaranteed non-null string, in OpenSSL error reporting. - Overall, we are missing a macro/function to make it easy to return a default string value when a string is null for a `%s` specifier, which is Undefined Behavior. Relying on standard libraries "catching it for us" is wrong and may fail on some platforms. This PR makes sure CHIPCryptoPALOpenSSL error reporting never uses a null string argument. This is now valid by construction without needing to validate the underlying implementations. This PR also adds `DefaultStringWhenNull` and `StringOrNullMarker` utilities to assist others in doing this safely Testing done: - Unit tests and cert tests all pass * Restyled by clang-format Co-authored-by: Restyled.io <[email protected]>
- Loading branch information