Cc: Yonghong Zhu <[email protected]>
Cc: Liming Gao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <[email protected]>
---
 BaseTools/Source/C/DevicePath/DevicePath.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c 
b/BaseTools/Source/C/DevicePath/DevicePath.c
index 4f859a0e44..b67ff412eb 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -183,6 +183,11 @@ int main(int argc, CHAR8 *argv[])
   }
   Ascii2UnicodeString(Str, Str16);
   DevicePath = UefiDevicePathLibConvertTextToDevicePath(Str16);
+  if (DevicePath == NULL) {
+    fprintf(stderr, "Convert fail, Cannot convert text to a device path");
+    free(Str16);
+    return STATUS_ERROR;
+  }
   while (!((DevicePath->Type == END_DEVICE_PATH_TYPE) && (DevicePath->SubType 
== END_ENTIRE_DEVICE_PATH_SUBTYPE)) )
   {
     PrintMem (DevicePath, DevicePath->Length[0] | DevicePath->Length[1] << 8);
-- 
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to