From 4faf5340467a9595b1df7f4faf43f78ec59d3157 Mon Sep 17 00:00:00 2001 From: Liming Gao <liming.gao@intel.com> 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 <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> --- 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;