BaseTools CommonLib: Update ReadMemoryFileLine() to read line in file scope

https://bugzilla.tianocore.org/show_bug.cgi?id=255

Check CurrentFilePointer to make sure it not exceed the end of file.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Liming Gao 2016-11-25 14:57:31 +08:00
parent ff9a1358b3
commit 60a5378208
1 changed files with 3 additions and 0 deletions

View File

@ -222,6 +222,9 @@ Returns:
// Increment the current file pointer (include the 0x0A)
//
InputFile->CurrentFilePointer += CharsToCopy + 1;
if (InputFile->CurrentFilePointer > InputFile->Eof) {
InputFile->CurrentFilePointer = InputFile->Eof;
}
CheckMemoryFileState (InputMemoryFile);
//