Skip to content

Commit c48d61a

Browse files
nordic-krchfabiobaltieri
authored andcommitted
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 <[email protected]>
1 parent b46d961 commit c48d61a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/os/cbprintf_packaged.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,7 @@ int cbprintf_package_convert(void *in_packaged,
982982
str_pos++;
983983
}
984984
} else {
985-
if (ros_nbr && flags & CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR) {
986-
str_pos += ros_nbr;
987-
}
985+
str_pos += ros_nbr;
988986
}
989987

990988
bool drop_ro_str_pos = !(flags &

0 commit comments

Comments
 (0)