aboutsummaryrefslogtreecommitdiffstats
path: root/wintun.c
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-07-31 13:51:35 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-02 09:43:32 +0000
commitafdbc75bf9edfb7b292b5795b59553ecc0ef0926 (patch)
tree75b5790778d15a0ec1f473f15278d56e432d0869 /wintun.c
parentAdd SDVView target (diff)
downloadwintun-afdbc75bf9edfb7b292b5795b59553ecc0ef0926.tar.xz
wintun-afdbc75bf9edfb7b292b5795b59553ecc0ef0926.zip
Resolve SDV reported "defect"
NdisMGetDeviceProperty() should always return non-NULL FunctionalDeviceObject according to _Outptr_opt_. An explicit FunctionalDeviceObject NULL check has been added to keep the SDV happy and not calling our driver "defective". Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'wintun.c')
-rw-r--r--wintun.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/wintun.c b/wintun.c
index fae78bc..0dbd1dd 100644
--- a/wintun.c
+++ b/wintun.c
@@ -930,6 +930,8 @@ TunInitializeEx(
Ctx->MiniportAdapterHandle = MiniportAdapterHandle;
NdisMGetDeviceProperty(MiniportAdapterHandle, NULL, &Ctx->FunctionalDeviceObject, NULL, NULL, NULL);
+ if (Status = NDIS_STATUS_FAILURE, !Ctx->FunctionalDeviceObject)
+ goto cleanupFreeCtx;
/* Reverse engineering indicates that we'd be better off calling
* NdisWdfGetAdapterContextFromAdapterHandle(functional_device),
* which points to our TUN_CTX object directly, but this isn't