diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c b/BaseTools/Source/C/Common/PcdValueCommon.c index 32963e6c67..92328daa16 100644 --- a/BaseTools/Source/C/Common/PcdValueCommon.c +++ b/BaseTools/Source/C/Common/PcdValueCommon.c @@ -335,7 +335,7 @@ Returns: printf("%x\n", Byte); Value = End + 1; } - Buffer = malloc(*Size); + Buffer = malloc(*Size + 1); if (Buffer == NULL) { *Size = 0; return NULL;