summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2016-11-25 14:57:31 +0800
committerLiming Gao <liming.gao@intel.com>2016-11-30 08:40:11 +0800
commit60a5378208f8b60e0a04ac724a639ad19158e778 (patch)
treebf0b8f9768424c0973554b617775cc34bbf0c7f9
parentff9a1358b3ff98b1c3a9b4b584fca71653a1c9fe (diff)
downloadedk2-60a5378208f8b60e0a04ac724a639ad19158e778.tar.gz
edk2-60a5378208f8b60e0a04ac724a639ad19158e778.tar.bz2
edk2-60a5378208f8b60e0a04ac724a639ad19158e778.zip
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>
-rw-r--r--BaseTools/Source/C/Common/MemoryFile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/BaseTools/Source/C/Common/MemoryFile.c b/BaseTools/Source/C/Common/MemoryFile.c
index 1d9068822e..ec27619abb 100644
--- a/BaseTools/Source/C/Common/MemoryFile.c
+++ b/BaseTools/Source/C/Common/MemoryFile.c
@@ -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);
//