* [Patch] BaseTools CommonLib: Update ReadMemoryFileLine() to read line in file scope
@ 2016-11-25 7:22 Liming Gao
2016-11-29 3:45 ` Zhu, Yonghong
0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2016-11-25 7:22 UTC (permalink / raw)
To: edk2-devel
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>
---
BaseTools/Source/C/Common/MemoryFile.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/BaseTools/Source/C/Common/MemoryFile.c b/BaseTools/Source/C/Common/MemoryFile.c
index 1d90688..ec27619 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);
//
--
2.8.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] BaseTools CommonLib: Update ReadMemoryFileLine() to read line in file scope
2016-11-25 7:22 [Patch] BaseTools CommonLib: Update ReadMemoryFileLine() to read line in file scope Liming Gao
@ 2016-11-29 3:45 ` Zhu, Yonghong
0 siblings, 0 replies; 2+ messages in thread
From: Zhu, Yonghong @ 2016-11-29 3:45 UTC (permalink / raw)
To: Gao, Liming, edk2-devel@lists.01.org
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Gao, Liming
Sent: Friday, November 25, 2016 3:23 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>
Subject: [Patch] 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>
---
BaseTools/Source/C/Common/MemoryFile.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/BaseTools/Source/C/Common/MemoryFile.c b/BaseTools/Source/C/Common/MemoryFile.c
index 1d90688..ec27619 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);
//
--
2.8.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-29 3:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-25 7:22 [Patch] BaseTools CommonLib: Update ReadMemoryFileLine() to read line in file scope Liming Gao
2016-11-29 3:45 ` Zhu, Yonghong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox