lib: os: cbprintf: Fix size miscalculation in cbprintf_convert
When package contained RO string positions and flag indicates that they shall not be kept, length was miscalculated which could lead to failures (e.g. memory corruption). Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
b46d961abf
commit
c48d61a4b4
|
@ -982,10 +982,8 @@ int cbprintf_package_convert(void *in_packaged,
|
||||||
str_pos++;
|
str_pos++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ros_nbr && flags & CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR) {
|
|
||||||
str_pos += ros_nbr;
|
str_pos += ros_nbr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool drop_ro_str_pos = !(flags &
|
bool drop_ro_str_pos = !(flags &
|
||||||
(CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR |
|
(CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR |
|
||||||
|
|
Loading…
Reference in a new issue