lib: os: cbprintf: Add assert to Z_CBPRINTF_ON_STACK_ALLOC

Add protection if number of string arguments exceed the limit
which currently is set to 32.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2022-03-14 15:21:01 +01:00 committed by Carles Cufí
parent 786647bdcf
commit 80c59df211

View file

@ -359,6 +359,7 @@ union z_cbprintf_hdr {
* multiple times. VLA is not always available.
*/
#define Z_CBPRINTF_ON_STACK_ALLOC(_name, _len) \
__ASSERT(_len <= 32, "Too many string arguments."); \
uint8_t _name##_buf4[4]; \
uint8_t _name##_buf8[8]; \
uint8_t _name##_buf12[12]; \