]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/Split/Split.c
BaseTools/Split: Fix the segmentation fault in GetSplitValue()
[mirror_edk2.git] / BaseTools / Source / C / Split / Split.c
index 7ab66be9e873a2c3cadfea197c936b8a4e914585..6b0a32376d332ff65d6d7c295a1b5eb6e13428e3 100644 (file)
@@ -2,7 +2,7 @@
 \r
   Split a file into two pieces at the request offset.\r
 \r
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials are licensed and made available\r
 under the terms and conditions of the BSD License which accompanies this\r
 distribution.  The full text of the license may be found at\r
@@ -80,7 +80,7 @@ Returns:
 --*/\r
 {\r
   Version();\r
-  printf ("Copyright (c) 1999-2016 Intel Corporation. All rights reserved.\n");\r
+  printf ("Copyright (c) 1999-2017 Intel Corporation. All rights reserved.\n");\r
   printf ("\n  SplitFile creates two Binary files either in the same directory as the current working\n");\r
   printf ("  directory or in the specified directory.\n");\r
   printf ("\nUsage: \n\\r
@@ -103,13 +103,17 @@ GetSplitValue (
   OUT UINT64 *ReturnValue\r
 )\r
 {\r
-  UINT64 len = strlen(SplitValueString);\r
+  UINT64 len = 0;\r
   UINT64 base = 1;\r
   UINT64 index = 0;\r
   UINT64 number = 0;\r
   CHAR8 lastCHAR = 0;\r
   EFI_STATUS Status = EFI_SUCCESS;\r
 \r
+  if (SplitValueString != NULL){\r
+    len = strlen(SplitValueString);\r
+  }\r
+\r
   if (len == 0) {\r
     return EFI_ABORTED;\r
   }\r