]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools CommonLib: Update ReadMemoryFileLine() to read line in file scope
authorLiming Gao <liming.gao@intel.com>
Fri, 25 Nov 2016 06:57:31 +0000 (14:57 +0800)
committerLiming Gao <liming.gao@intel.com>
Wed, 30 Nov 2016 00:40:11 +0000 (08:40 +0800)
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>
BaseTools/Source/C/Common/MemoryFile.c

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