]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/String.c
MdePkg/BaseLib: Add an additional check within (Ascii)StrnCmp
[mirror_edk2.git] / MdePkg / Library / BaseLib / String.c
index 25962f85b25ca085bae8e72d0a24c5f54fe7a8fd..fa96d1c1eec8ceedd3f7bc0da8f31e839ce0b675 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Unicode and ASCII string primitives.\r
 \r
-  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -315,6 +315,7 @@ StrnCmp (
   }\r
 \r
   while ((*FirstString != L'\0') &&\r
+         (*SecondString != L'\0') &&\r
          (*FirstString == *SecondString) &&\r
          (Length > 1)) {\r
     FirstString++;\r
@@ -1474,6 +1475,7 @@ AsciiStrnCmp (
   }\r
 \r
   while ((*FirstString != '\0') &&\r
+         (*SecondString != '\0') &&\r
          (*FirstString == *SecondString) &&\r
          (Length > 1)) {\r
     FirstString++;\r