]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix two issues:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 6 Nov 2007 01:38:25 +0000 (01:38 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 6 Nov 2007 01:38:25 +0000 (01:38 +0000)
1. EDK II StrnCpy does not necessarily "0" terminate destination string if the source string length is larger than "n". Caller needs to terminate it itself.
2. The definition of EFI_HII_CALLBACK_PACKET has been changed to follow framework HII spec 0.92, we need to change the corresponding code correctly.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4270 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/SetupBrowserDxe/InputHandler.c
IntelFrameworkModulePkg/Universal/SetupBrowserDxe/Presentation.c

index bd0c853a05ccd66c15ef1e9c813ad6af764057ae..3c0a0785abf63c5c77d96a172a0c1bdb0d46cd36 100644 (file)
@@ -290,7 +290,7 @@ ReadPassword (
       SecondEntry = TRUE;\r
     } else if (Status == EFI_NOT_READY) {\r
 Error:\r
-      if (Packet != NULL) {\r
+      if (Packet != NULL && Packet->String != NULL) {\r
         //\r
         // Upon error, we will likely receive a string to print out\r
         // Display error popup\r
@@ -403,7 +403,7 @@ Error:
           //\r
           if (Confirmation) {\r
             if (EFI_ERROR (Status)) {\r
-              if (Packet->String == NULL) {\r
+              if (Packet == NULL || Packet->String == NULL) {\r
                 WidthOfString = GetStringWidth (gConfirmError);\r
                 ScreenSize = MAX (WidthOfString, GetStringWidth (gPressEnter)) / 2;\r
                 CreatePopUp (ScreenSize, 4, &NullCharacter, gConfirmError, gPressEnter, &NullCharacter);\r
@@ -513,12 +513,14 @@ Error:
       //\r
       default:\r
         if ((StringPtr[0] == CHAR_NULL) && (Key.UnicodeChar != CHAR_BACKSPACE)) {\r
+          StringPtr[0] = Key.UnicodeChar;\r
+          StringPtr[1] = CHAR_NULL;\r
           if (!Confirmation) {\r
-            StrnCpy (StringPtr, &Key.UnicodeChar, 1);\r
-            StrnCpy (TempString, &Key.UnicodeChar, 1);\r
+            TempString[0] = Key.UnicodeChar;\r
+            TempString[1] = CHAR_NULL;\r
           } else {\r
-            StrnCpy (StringPtr, &Key.UnicodeChar, 1);\r
-            StrnCpy (TempString2, &Key.UnicodeChar, 1);\r
+            TempString2[0] = Key.UnicodeChar;\r
+            TempString2[1] = CHAR_NULL;\r
             ConfirmationComplete = FALSE;\r
           }\r
         } else if ((GetStringWidth (StringPtr) / 2 <= (UINTN) (MenuOption->ThisTag->Maximum - 1) / 2) &&\r
index 3452a8d5a24c1dd674b4a67fe7d2d9b309bae3d7..074b009514321dc35e3da0b7c6669afbe5a63992 100644 (file)
@@ -1236,7 +1236,7 @@ Returns:
       Selection->ThisTag->StorageWidth\r
       );\r
 \r
-    if (Packet != NULL) {\r
+    if (Packet != NULL && Packet->String != NULL) {\r
       //\r
       // Upon error, we will likely receive a string to print out\r
       //\r