[edk2] [Patch] BaseTools: CommonLib Fix Crash to write the last byte

Liming Gao posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
BaseTools/Source/C/Common/PcdValueCommon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2] [Patch] BaseTools: CommonLib Fix Crash to write the last byte
Posted by Liming Gao 6 years, 9 months ago
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@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 32963e6..92328da 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;
-- 
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] BaseTools: CommonLib Fix Crash to write the last byte
Posted by Zhu, Yonghong 6 years, 9 months ago
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>

Best Regards,
Zhu Yonghong


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Thursday, January 25, 2018 9:42 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [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>
---
 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 32963e6..92328da 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;
-- 
2.8.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel