public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: chenbo@pdx.edu, Liming Gao <liming.gao@intel.com>
Subject: [Patch 1/6] BaseTools/Split: Fix the segmentation fault in GetSplitValue()
Date: Thu, 27 Jul 2017 09:42:27 +0800	[thread overview]
Message-ID: <1501119752-3856-2-git-send-email-yonghong.zhu@intel.com> (raw)
In-Reply-To: <1501119752-3856-1-git-send-email-yonghong.zhu@intel.com>

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>
---
 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 7ab66be..6b0a323 100644
--- a/BaseTools/Source/C/Split/Split.c
+++ b/BaseTools/Source/C/Split/Split.c
@@ -1,10 +1,10 @@
 /** @file
 
   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
 http://opensource.org/licenses/bsd-license.php
 
@@ -78,11 +78,11 @@ Returns:
   GC_TODO: add return values
 
 --*/
 {
   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\
    Split\n\
      -f, --filename inputFile to split\n\
@@ -101,17 +101,21 @@ EFI_STATUS
 GetSplitValue (
   IN CONST CHAR8* SplitValueString,
   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;
   }
 
   Status = AsciiStringToUint64 (SplitValueString, FALSE, ReturnValue);
-- 
2.6.1.windows.1



  reply	other threads:[~2017-07-27  1:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27  1:42 [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Yonghong Zhu
2017-07-27  1:42 ` Yonghong Zhu [this message]
2017-07-27  1:42 ` [Patch 2/6] BaseTools/GenSec: Fix a segmentation fault in main() Yonghong Zhu
2017-07-27  1:42 ` [Patch 3/6] BaseTools/GenFfs: Fix a segmentation fault from vsprintf()/vfprintf() Yonghong Zhu
2017-07-27  1:42 ` [Patch 4/6] BaseTools/EfiRom: " Yonghong Zhu
2017-07-27  1:42 ` [Patch 5/6] BaseTools/EfiLdrImage: Fix a segmentation fault from vfprintf() Yonghong Zhu
2017-07-27  1:42 ` [Patch 6/6] BaseTools/GenCrc32: Fix a bug to hand empty file for decode Yonghong Zhu
2017-08-01  2:41 ` [Patch 0/6] BaseTools: Fix some segmentation fault in Tools Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1501119752-3856-2-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox