lib: os: cbprintf: Fix legth field in static package
Byte value was written instead of word.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
diff --git a/include/sys/cbprintf_internal.h b/include/sys/cbprintf_internal.h
index 49d80db..ffb483b 100644
--- a/include/sys/cbprintf_internal.h
+++ b/include/sys/cbprintf_internal.h
@@ -306,7 +306,9 @@
_outlen = (_pkg_len > _pmax) ? -ENOSPC : _pkg_len; \
/* Store length in the header, set number of dumped strings to 0 */ \
if (_pbuf) { \
- union z_cbprintf_hdr hdr = { .desc = {.len = _pkg_len }}; \
+ union z_cbprintf_hdr hdr = { \
+ .desc = {.len = _pkg_len / sizeof(int) } \
+ }; \
*_len_loc = hdr; \
} \
_Pragma("GCC diagnostic pop") \