aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-06-20 12:00:21 +0200
committerSimon Rozman <simon@rozman.si>2019-06-20 12:00:21 +0200
commitfaf810e8cb76ce88e61591610bcb626b7a08c62b (patch)
tree249a3ca86e0a2decd66f6904ea93696d051da697
parentSave some valuable lessons learned on Windows internals (diff)
downloadwintun-faf810e8cb76ce88e61591610bcb626b7a08c62b.tar.xz
wintun-faf810e8cb76ce88e61591610bcb626b7a08c62b.zip
Fix NdisQueryMdl() NULL-buffer check
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r--wintun.c3
1 files changed, 2 insertions, 1 deletions
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;