summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/C/Split/Split.c
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2017-07-19 10:53:06 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2017-08-01 10:50:07 +0800
commit15face06f400283e227aa814bf3180ccd19328a3 (patch)
tree8f756a936367d4ef18f455e8a1d1b1a81c6319e6 /BaseTools/Source/C/Split/Split.c
parentc65df5d9a14331d2b6d583359f1cf88c3b710d34 (diff)
downloadedk2-15face06f400283e227aa814bf3180ccd19328a3.tar.gz
edk2-15face06f400283e227aa814bf3180ccd19328a3.tar.bz2
edk2-15face06f400283e227aa814bf3180ccd19328a3.zip
BaseTools/Split: Fix the segmentation fault in GetSplitValue()
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=538 Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/C/Split/Split.c')
-rw-r--r--BaseTools/Source/C/Split/Split.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c
index 7ab66be9e8..6b0a32376d 100644
--- a/BaseTools/Source/C/Split/Split.c
+++ b/BaseTools/Source/C/Split/Split.c
@@ -2,7 +2,7 @@
Split a file into two pieces at the request offset.
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -80,7 +80,7 @@ Returns:
--*/
{
Version();
- printf ("Copyright (c) 1999-2016 Intel Corporation. All rights reserved.\n");
+ printf ("Copyright (c) 1999-2017 Intel Corporation. All rights reserved.\n");
printf ("\n SplitFile creates two Binary files either in the same directory as the current working\n");
printf (" directory or in the specified directory.\n");
printf ("\nUsage: \n\
@@ -103,13 +103,17 @@ GetSplitValue (
OUT UINT64 *ReturnValue
)
{
- UINT64 len = strlen(SplitValueString);
+ UINT64 len = 0;
UINT64 base = 1;
UINT64 index = 0;
UINT64 number = 0;
CHAR8 lastCHAR = 0;
EFI_STATUS Status = EFI_SUCCESS;
+ if (SplitValueString != NULL){
+ len = strlen(SplitValueString);
+ }
+
if (len == 0) {
return EFI_ABORTED;
}