Author: arty
Date: Sat Apr 19 18:16:39 2008
New Revision: 33041
URL:
http://svn.reactos.org/svn/reactos?rev=33041&view=rev
Log:
Fix two very small bugs found by running this code in valgrind.
Modified:
trunk/reactos/boot/freeldr/freeldr/inifile/inifile.c
trunk/reactos/boot/freeldr/freeldr/inifile/parse.c
Modified: trunk/reactos/boot/freeldr/freeldr/inifile/inifile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inifi…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/inifile/inifile.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/inifile/inifile.c [iso-8859-1] Sat Apr 19 18:16:39
2008
@@ -34,7 +34,8 @@
if (_stricmp(SectionName, Section->SectionName) == 0)
{
// We found it
- *SectionId = (ULONG)Section;
+ if (SectionId)
+ *SectionId = (ULONG)Section;
DbgPrint((DPRINT_INIFILE, "IniOpenSection() Found it! SectionId = 0x%x\n",
SectionId));
return TRUE;
}
Modified: trunk/reactos/boot/freeldr/freeldr/inifile/parse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inifi…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/inifile/parse.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/inifile/parse.c [iso-8859-1] Sat Apr 19 18:16:39
2008
@@ -232,9 +232,9 @@
Buffer[Idx] = '\0';
// Get rid of newline & linefeed characters (if any)
- if((Buffer[strlen(Buffer)-1] == '\n') || (Buffer[strlen(Buffer)-1] ==
'\r'))
+ if(strlen(Buffer) && ((Buffer[strlen(Buffer)-1] == '\n') ||
(Buffer[strlen(Buffer)-1] == '\r')))
Buffer[strlen(Buffer)-1] = '\0';
- if((Buffer[strlen(Buffer)-1] == '\n') || (Buffer[strlen(Buffer)-1] ==
'\r'))
+ if(strlen(Buffer) && ((Buffer[strlen(Buffer)-1] == '\n') ||
(Buffer[strlen(Buffer)-1] == '\r')))
Buffer[strlen(Buffer)-1] = '\0';
// Send back new offset