summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/C/DevicePath/DevicePath.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/C/DevicePath/DevicePath.c
index c4d224ed61..ed19eb52f6 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
fprintf(stderr, "Invalid option value, Device Path can't be NULL");
return STATUS_ERROR;
}
- Str16 = (CHAR16 *)malloc(1024);
+ Str16 = (CHAR16 *)malloc((strlen (Str) + 1) * sizeof (CHAR16));
if (Str16 == NULL) {
fprintf(stderr, "Resource, memory cannot be allocated");
return STATUS_ERROR;