From 0a030a201e52e18ed4df68ff0dff84096eb98bce Mon Sep 17 00:00:00 2001 From: srs5694 Date: Wed, 8 Apr 2015 10:31:10 -0400 Subject: [PATCH] Fixed bug that caused crash when an empty refind_linux.conf file was encountered. --- NEWS.txt | 3 +++ refind/config.c | 4 ++++ refind/main.c | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 71d48ad..98030ac 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,6 +1,9 @@ 0.8.8 (3/??/2015): ------------------ +- Fixed bug that caused a rEFInd crash if an empty refind_linux.conf + file was encountered. + - The mkrlconf.sh script now checks the OS on which it's running, which should help avoid confusion or problems by users who mistakenly run it under OS X. diff --git a/refind/config.c b/refind/config.c index 573a5db..fa1d9a6 100644 --- a/refind/config.c +++ b/refind/config.c @@ -267,6 +267,10 @@ UINTN ReadTokenLine(IN REFIT_FILE *File, OUT CHAR16 ***TokenList) Line = ReadLine(File); if (Line == NULL) return(0); + if (Line[0] == L'\0') { + MyFreePool(Line); + return(0); + } // if p = Line; LineFinished = FALSE; diff --git a/refind/main.c b/refind/main.c index 3f40c12..c107fa4 100644 --- a/refind/main.c +++ b/refind/main.c @@ -166,7 +166,7 @@ static VOID AboutrEFInd(VOID) if (AboutMenu.EntryCount == 0) { AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT); - AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.7.3"); + AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.8.7.4"); AddMenuInfoLine(&AboutMenu, L""); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer"); AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2015 Roderick W. Smith"); @@ -773,7 +773,7 @@ VOID GenerateSubScreen(LOADER_ENTRY *Entry, IN REFIT_VOLUME *Volume) { // first entry requires special processing, since it was initially set // up with a default title but correct options by InitializeSubScreen(), // earlier.... - if ((SubScreen->Entries != NULL) && (SubScreen->Entries[0] != NULL)) { + if ((TokenCount > 1) && (SubScreen->Entries != NULL) && (SubScreen->Entries[0] != NULL)) { MyFreePool(SubScreen->Entries[0]->Title); SubScreen->Entries[0]->Title = TokenList[0] ? StrDuplicate(TokenList[0]) : StrDuplicate(L"Boot Linux"); } // if -- 2.39.2