Commit c48d61a4 authored by Krzysztof Chruściński's avatar Krzysztof Chruściński Committed by Fabio Baltieri
Browse files

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: default avatarKrzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
parent b46d961a
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -982,10 +982,8 @@ int cbprintf_package_convert(void *in_packaged,
				str_pos++;
			}
		} else {
			if (ros_nbr && flags & CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR) {
			str_pos += ros_nbr;
		}
		}

		bool drop_ro_str_pos = !(flags &
					(CBPRINTF_PACKAGE_CONVERT_KEEP_RO_STR |