Skip to content

Commit

Permalink
TLV test uses wrong size on strncmp (#15358)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecille authored and pull[bot] committed Nov 15, 2023
1 parent 5ae7ab1 commit 38bab7f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/core/tests/TestCHIPTLV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2581,10 +2581,10 @@ void CheckCHIPTLVPutStringF(nlTestSuite * inSuite, void * inContext)
err = reader.Next();
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

err = reader.GetString(valStr, 256);
err = reader.GetString(valStr, bufsize);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

NL_TEST_ASSERT(inSuite, strncmp(valStr, strBuffer, 256) == 0);
NL_TEST_ASSERT(inSuite, strncmp(valStr, strBuffer, bufsize) == 0);
}

void CheckCHIPTLVPutStringSpan(nlTestSuite * inSuite, void * inContext)
Expand Down Expand Up @@ -2629,10 +2629,10 @@ void CheckCHIPTLVPutStringSpan(nlTestSuite * inSuite, void * inContext)
err = reader.Next();
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

err = reader.GetString(valStr, 256);
err = reader.GetString(valStr, bufsize);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

NL_TEST_ASSERT(inSuite, strncmp(valStr, strBuffer, 256) == 0);
NL_TEST_ASSERT(inSuite, strncmp(valStr, strBuffer, bufsize) == 0);
}
}

Expand Down

0 comments on commit 38bab7f

Please sign in to comment.