Skip to content

Commit

Permalink
Merge pull request #67 from jphickey/fix-66-ut-strncpy
Browse files Browse the repository at this point in the history
Fix #66, correct buffer overflows in UT
  • Loading branch information
dzbaker authored Jan 19, 2023
2 parents 779b903 + fee9f57 commit f49a965
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions unit-test/lc_action_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void LC_SampleSingleAP_Test_ActiveRequestRTS(void)

LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS = 5;
LC_OperData.ARTPtr[APNumber].ConsecutiveFailCount = LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS;
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", 50);
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", sizeof(LC_OperData.ADTPtr[APNumber].EventText));

/* Execute the function being tested */
LC_SampleSingleAP(APNumber);
Expand Down Expand Up @@ -274,7 +274,7 @@ void LC_SampleSingleAP_Test_APFailWhileLCStatePassive(void)

LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS = 5;
LC_OperData.ARTPtr[APNumber].ConsecutiveFailCount = LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS;
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", 50);
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", sizeof(LC_OperData.ADTPtr[APNumber].EventText));

/* Execute the function being tested */
LC_SampleSingleAP(APNumber);
Expand Down Expand Up @@ -318,7 +318,7 @@ void LC_SampleSingleAP_Test_APFailWhilePassive(void)

LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS = 5;
LC_OperData.ARTPtr[APNumber].ConsecutiveFailCount = LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS;
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", 50);
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", sizeof(LC_OperData.ADTPtr[APNumber].EventText));

LC_OperData.ADTPtr[APNumber].MaxPassiveEvents = 5;
LC_OperData.ARTPtr[APNumber].PassiveAPCount = LC_OperData.ADTPtr[APNumber].MaxPassiveEvents - 1;
Expand Down Expand Up @@ -363,7 +363,7 @@ void LC_SampleSingleAP_Test_APFailWhilePassiveNoEvent(void)

LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS = 5;
LC_OperData.ARTPtr[APNumber].ConsecutiveFailCount = LC_OperData.ADTPtr[APNumber].MaxFailsBeforeRTS;
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", 50);
strncpy(LC_OperData.ADTPtr[APNumber].EventText, "Event Message", sizeof(LC_OperData.ADTPtr[APNumber].EventText));

LC_OperData.ADTPtr[APNumber].MaxPassiveEvents = 5;
LC_OperData.ARTPtr[APNumber].PassiveAPCount = LC_OperData.ADTPtr[APNumber].MaxPassiveEvents + 1;
Expand Down

0 comments on commit f49a965

Please sign in to comment.