diff --git a/BaseTools/Source/C/Common/MemoryFile.c b/BaseTools/Source/C/Common/MemoryFile.c index 7b1aa111d1..00ea0c615b 100644 --- a/BaseTools/Source/C/Common/MemoryFile.c +++ b/BaseTools/Source/C/Common/MemoryFile.c @@ -194,7 +194,7 @@ Returns: CharsToCopy = EndOfLine - InputFile->CurrentFilePointer; } - OutputString = malloc (CharsToCopy); + OutputString = malloc (CharsToCopy + 1); if (OutputString == NULL) { return NULL; }