Revision: 18047
http://sourceforge.net/p/edk2/code/18047
Author: jljusten
Date: 2015-07-26 08:03:15 +0000 (Sun, 26 Jul 2015)
Log Message:
-----------
BaseTools/Common: fix heap overrun in ReadMemoryFileLine ()
ReadMemoryFileLine () appends a NULL character to the string
it returns, but it failed to account for it in the allocation.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Yingke Liu <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
Modified Paths:
--------------
trunk/edk2/BaseTools/Source/C/Common/MemoryFile.c
Modified: trunk/edk2/BaseTools/Source/C/Common/MemoryFile.c
===================================================================
--- trunk/edk2/BaseTools/Source/C/Common/MemoryFile.c 2015-07-26 08:03:10 UTC
(rev 18046)
+++ trunk/edk2/BaseTools/Source/C/Common/MemoryFile.c 2015-07-26 08:03:15 UTC
(rev 18047)
@@ -194,7 +194,7 @@
CharsToCopy = EndOfLine - InputFile->CurrentFilePointer;
}
- OutputString = malloc (CharsToCopy);
+ OutputString = malloc (CharsToCopy + 1);
if (OutputString == NULL) {
return NULL;
}
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits