Skip to content

Commit

Permalink
Add coverage for NULL buffer to GetParam tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anrossi committed Feb 4, 2025
1 parent 098f9e6 commit 7fc999b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/lib/TestHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@ void SimpleGetParamTest(HQUIC Handle, uint32_t Param, size_t ExpectedLength, voi
}
}

//
// Call with correct length now, but NULL buffer for added coverage.
//
TEST_QUIC_STATUS(
QUIC_STATUS_INVALID_PARAMETER,
MsQuic->GetParam(
Handle,
Param,
&Length,
nullptr));

Length = (uint32_t)ExpectedLength; // Only query the expected size, which might be less.
void* Value = CXPLAT_ALLOC_NONPAGED(Length, QUIC_POOL_TEST);
if (Value == nullptr) {
Expand Down

0 comments on commit 7fc999b

Please sign in to comment.