[ros-diffs] [sginsberg] 37848: - Don't cache a value if we might dereference NULL - Fix for CID 653

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Thu Dec 4 16:15:02 CET 2008


Author: sginsberg
Date: Thu Dec  4 09:15:01 2008
New Revision: 37848

URL: http://svn.reactos.org/svn/reactos?rev=37848&view=rev
Log:
- Don't cache a value if we might dereference NULL
- Fix for CID 653

Modified:
    trunk/reactos/lib/rtl/unicodeprefix.c

Modified: trunk/reactos/lib/rtl/unicodeprefix.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicodeprefix.c?rev=37848&r1=37847&r2=37848&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/unicodeprefix.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/unicodeprefix.c [iso-8859-1] Thu Dec  4 09:15:01 2008
@@ -465,13 +465,14 @@
                      BOOLEAN Restart)
 {
     PRTL_SPLAY_LINKS SplayLinks;
-    PUNICODE_PREFIX_TABLE_ENTRY Entry, CaseMatchEntry;
+    PUNICODE_PREFIX_TABLE_ENTRY Entry, CaseMatchEntry = NULL;
 
     DPRINT("RtlNextUnicodePrefix(): Table %p Restart %b\n",
         PrefixTable, Restart);
 
     /* We might need this entry 2/3rd of the time, so cache it now */
-    CaseMatchEntry = PrefixTable->LastNextEntry->CaseMatch;
+    if (PrefixTable->LastNextEntry)
+        CaseMatchEntry = PrefixTable->LastNextEntry->CaseMatch;
 
     /* Check if this is a restart or if we don't have a last entry */
     if ((Restart) || !(PrefixTable->LastNextEntry))



More information about the Ros-diffs mailing list