https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b3b2a23f05e5188dc1475961fcd7f036f0046d25

commit b3b2a23f05e5188dc1475961fcd7f036f0046d25
Author: Samuel Serapion <[email protected]>
AuthorDate: Fri Oct 20 14:00:32 2017 -0400

    CID 1206831 Dereference after null check
    
    BytesRead is an optional out parameter and must be checked before being 
written to.
---
 sdk/lib/rtl/memstream.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sdk/lib/rtl/memstream.c b/sdk/lib/rtl/memstream.c
index 0549424ca4..8fe4169fb1 100644
--- a/sdk/lib/rtl/memstream.c
+++ b/sdk/lib/rtl/memstream.c
@@ -185,7 +185,8 @@ RtlReadMemoryStream(
 
     Stream->Current = (PUCHAR)Stream->Current + CopyLength;
 
-    *BytesRead = CopyLength;
+    if (BytesRead)
+        *BytesRead = CopyLength;
 
     return S_OK;
 }

Reply via email to