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 <ard.biesheuvel@linaro.org>
Reviewed-by: Yingke Liu <yingke.d.liu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18047 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ard Biesheuvel 2015-07-26 08:03:15 +00:00 committed by jljusten
parent 339a9f162c
commit 2cec9ccde7
1 changed files with 1 additions and 1 deletions

View File

@ -194,7 +194,7 @@ Returns:
CharsToCopy = EndOfLine - InputFile->CurrentFilePointer;
}
OutputString = malloc (CharsToCopy);
OutputString = malloc (CharsToCopy + 1);
if (OutputString == NULL) {
return NULL;
}