From faf810e8cb76ce88e61591610bcb626b7a08c62b Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 20 Jun 2019 12:00:21 +0200 Subject: [PATCH] Fix NdisQueryMdl() NULL-buffer check Signed-off-by: Simon Rozman --- wintun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wintun.c b/wintun.c index 3a8657c..aa201b4 100644 --- a/wintun.c +++ b/wintun.c @@ -258,8 +258,9 @@ static NTSTATUS TunGetIrpBuffer(_In_ IRP *Irp, _Out_ UCHAR **buffer, _Out_ ULONG if (!Irp->MdlAddress) return STATUS_INVALID_PARAMETER; ULONG size_mdl; + *buffer = NULL; NdisQueryMdl(Irp->MdlAddress, buffer, &size_mdl, priority); - if (!buffer) + if (!*buffer) return STATUS_INSUFFICIENT_RESOURCES; if (size_mdl < *size) *size = size_mdl;