From 15face06f400283e227aa814bf3180ccd19328a3 Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Wed, 19 Jul 2017 10:53:06 +0800 Subject: [PATCH] BaseTools/Split: Fix the segmentation fault in GetSplitValue() Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=538 Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/C/Split/Split.c | 10 +++++++--- 1 file 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.
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
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; }