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... ============================================================================== --- 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))