diff --git a/reactos/boot/freeldr/freeldr/inifile/inifile.c b/reactos/boot/freeldr/freeldr/inifile/inifile.c index 038c0e764a8..63b412b78e7 100644 --- a/reactos/boot/freeldr/freeldr/inifile/inifile.c +++ b/reactos/boot/freeldr/freeldr/inifile/inifile.c @@ -34,7 +34,8 @@ BOOLEAN IniOpenSection(PCSTR SectionName, ULONG* SectionId) 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; } diff --git a/reactos/boot/freeldr/freeldr/inifile/parse.c b/reactos/boot/freeldr/freeldr/inifile/parse.c index 572cb62ed9b..531125a9229 100644 --- a/reactos/boot/freeldr/freeldr/inifile/parse.c +++ b/reactos/boot/freeldr/freeldr/inifile/parse.c @@ -232,9 +232,9 @@ ULONG IniGetNextLine(PCHAR IniFileData, ULONG IniFileSize, PCHAR Buffer, ULONG B 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