]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/FileImage.c
pointer verification (not NULL) and buffer overrun fixes.
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / FileImage.c
index adf79281974e77c84807f056109878bb7f0363f4..fd6387a20a9a78e98e8817dc696259c859a6d245 100644 (file)
@@ -301,6 +301,7 @@ Returns:
   HBufferImage.HighBits               = TRUE;\r
   HBufferImage.BufferPosition.Row     = 1;\r
   HBufferImage.BufferPosition.Column  = 1;\r
   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
 \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
   //\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
     //\r
     // check whether file exists on disk\r
     //\r