Skip to content

Commit 9d48c55

Browse files
committed
ConnectToEc: Bail if passed nullptr
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 6ac33dd commit 9d48c55

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

FrameworkSensors/EcCommunication.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@
2121
NTSTATUS ConnectToEc(
2222
_Inout_ HANDLE* Handle
2323
) {
24-
NTSTATUS Status = STATUS_SUCCESS;
24+
if (Handle == NULL) {
25+
TraceError("%!FUNC! Handle pointer is NULL");
26+
return STATUS_INVALID_PARAMETER;
27+
}
2528

2629
if (*Handle != INVALID_HANDLE_VALUE) {
2730
// Already connected
2831
TraceError("%!FUNC! Already connected");
29-
return Status;
32+
return STATUS_SUCCESS;
3033
}
3134

3235
*Handle = CreateFileW(
@@ -44,7 +47,7 @@ NTSTATUS ConnectToEc(
4447
}
4548

4649
TraceInformation("%!FUNC! Got Handle");
47-
return Status;
50+
return STATUS_SUCCESS;
4851
}
4952

5053
int CrosEcSendCommand(

0 commit comments

Comments
 (0)