Skip to content

Commit ade82ef

Browse files
author
elizabeth.e.ash@nasa.gov
committed
Fix #1545, Added note for CodeSonar to ignore strcpy() usage in utassert.c
1 parent b6163fd commit ade82ef

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ut_assert/src/utassert.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ void UtAssert_EndTest(void)
180180
}
181181
memcpy(&Local_SegmentCounters, &UT_SegmentCounters, sizeof(Local_SegmentCounters));
182182

183-
strncpy(Local_SegmentName, CurrentSegment, sizeof(Local_SegmentName) - 1);
183+
/*
184+
* note, strcpy is OK because both are fixed size buffers of the same size,
185+
* and the null termination on CurrentSegment was locally enforced already
186+
* SAD: This should be ignored by CodeSonar.
187+
*/
188+
strcpy(Local_SegmentName, CurrentSegment);
184189
}
185190

186191
memset(&UT_SegmentCounters, 0, sizeof(UT_SegmentCounters));

0 commit comments

Comments
 (0)