diff options
author | Liming Gao <liming.gao@intel.com> | 2016-11-25 14:57:31 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2016-11-30 08:40:11 +0800 |
commit | 60a5378208f8b60e0a04ac724a639ad19158e778 (patch) | |
tree | bf0b8f9768424c0973554b617775cc34bbf0c7f9 /BaseTools/Source/C | |
parent | ff9a1358b3ff98b1c3a9b4b584fca71653a1c9fe (diff) | |
download | edk2-platforms-60a5378208f8b60e0a04ac724a639ad19158e778.tar.xz |
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>
Diffstat (limited to 'BaseTools/Source/C')
-rw-r--r-- | BaseTools/Source/C/Common/MemoryFile.c | 3 |
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);
//
|