pointer verification (not NULL) and buffer overrun fixes.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / FileImage.c
index adf7928..fd6387a 100644 (file)
@@ -301,6 +301,7 @@ Returns:
   HBufferImage.HighBits               = TRUE;\r
   HBufferImage.BufferPosition.Row     = 1;\r
   HBufferImage.BufferPosition.Column  = 1;\r
+  HBufferImage.BufferType = FileTypeFileBuffer;\r
 \r
   if (!Recover) {\r
     UnicodeBuffer = CatSPrint(NULL, L"%d Lines Read", HBufferImage.NumLines);\r
@@ -382,7 +383,7 @@ Returns:
   //\r
   // if is the old file\r
   //\r
-  if (StrCmp (FileName, HFileImage.FileName) == 0) {\r
+  if (HFileImage.FileName != NULL && FileName != NULL && StrCmp (FileName, HFileImage.FileName) == 0) {\r
     //\r
     // check whether file exists on disk\r
     //\r