From cd4ae3e1559d1ce5fc53ece73e60650c815e910f Mon Sep 17 00:00:00 2001 From: Liming Gao Date: Wed, 24 Jan 2018 23:24:28 +0800 Subject: [PATCH] BaseTools: CommonLib Fix Crash to write the last byte Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Reviewed-by: Yonghong Zhu (cherry picked from commit 4faf5340467a9595b1df7f4faf43f78ec59d3157) --- BaseTools/Source/C/Common/PcdValueCommon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;