Skip to content

Commit

Permalink
Merge pull request #1764 from jphickey/fix-1763-covtest-printf-log
Browse files Browse the repository at this point in the history
Fix #1763, last char truncated in coverage log output
  • Loading branch information
astrogeco authored Aug 9, 2021
2 parents 4c91565 + e07f222 commit 84bb9d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/core_private/ut-stubs/src/ut_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line,

/* Locate the actual end of the string, but limited to length of local buffer */
/* Reserve two extra chars for quotes */
EndPtr = memchr(FormatString, 0, sizeof(ScrubbedFormat) - 2);
EndPtr = memchr(FormatString, 0, sizeof(ScrubbedFormat) - 3);
if (EndPtr != NULL)
{
FormatLen = EndPtr - FormatString;
Expand All @@ -674,8 +674,8 @@ bool CFE_UtAssert_MessageCheck_Impl(bool Status, const char *File, uint32 Line,
/* Need to make a copy, as the input string is "const" */
ScrubbedFormat[0] = '\'';
memcpy(&ScrubbedFormat[1], FormatString, FormatLen);
ScrubbedFormat[FormatLen] = '\'';
ScrubbedFormat[FormatLen + 1] = 0;
ScrubbedFormat[FormatLen + 1] = '\'';
ScrubbedFormat[FormatLen + 2] = 0;

return UtAssert_GenericSignedCompare(Status, UtAssert_Compare_GT, 0, UtAssert_Radix_DECIMAL, File, Line, Desc,
ScrubbedFormat, "");
Expand Down

0 comments on commit 84bb9d7

Please sign in to comment.