pointer verification (not NULL) and buffer overrun fixes.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / TimeDate.c
index 115013a..780b39e 100644 (file)
@@ -124,7 +124,7 @@ CheckAndSetDate (
   if (Walker1 != NULL) {\r
     Walker = Walker1 + 1;\r
   }\r
-  Walker1 = StrStr(Walker, L"/");\r
+  Walker1 = Walker!=NULL?StrStr(Walker, L"/"):NULL;\r
   if (Walker1 != NULL && *Walker1 == L'/') {\r
     *Walker1 = CHAR_NULL;\r
   }\r
@@ -133,7 +133,7 @@ CheckAndSetDate (
     if (Walker1 != NULL) {\r
       Walker = Walker1 + 1;\r
     }\r
-    Walker1 = StrStr(Walker, L"/");\r
+    Walker1 = Walker!=NULL?StrStr(Walker, L"/"):NULL;\r
     if (Walker1 != NULL && *Walker1 == L'/') {\r
       *Walker1 = CHAR_NULL;\r
     }\r
@@ -312,7 +312,7 @@ CheckAndSetTime (
     TheTime.Hour    = 0xFF;\r
     TheTime.Minute  = 0xFF;\r
 \r
-    Walker2          = StrStr(Walker1, L":");\r
+    Walker2          = Walker1!=NULL?StrStr(Walker1, L":"):NULL;\r
     if (Walker2 != NULL && *Walker2 == L':') {\r
       *Walker2 = CHAR_NULL;\r
     }\r
@@ -320,7 +320,7 @@ CheckAndSetTime (
     if (Walker2 != NULL) {\r
       Walker1 = Walker2 + 1;\r
     }\r
-    Walker2          = StrStr(Walker1, L":");\r
+    Walker2          = Walker1!=NULL?StrStr(Walker1, L":"):NULL;\r
     if (Walker2 != NULL && *Walker2 == L':') {\r
       *Walker2 = CHAR_NULL;\r
     }\r