From: Hao Wu Date: Thu, 24 Nov 2016 02:43:33 +0000 (+0800) Subject: MdeModulePkg/EbcDebugger: Add ASSERT to ensure FieldBuffer is not NULL X-Git-Tag: edk2-stable201903~5080 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=eebfb7b2a52629f7c7268a9f5417ea86477c38eb MdeModulePkg/EbcDebugger: Add ASSERT to ensure FieldBuffer is not NULL In function EdbLoadCodBySymbolByIec(), AsciiStrGetNewTokenField() at line 1589 will return NULL if the first character in 'LineBuffer' is '\0'. But the previous if statement at line 1576 ensures the above case will not happen. This commit adds ASSERT as warnings for the case that will not happen. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Jiewen Yao --- diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c index 9573c43a9d..22a827d35d 100644 --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2007, Intel Corporation +Copyright (c) 2007 - 2016, 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 @@ -1587,6 +1587,7 @@ Returns: // get function name, function name is followed by char 0x09. // FieldBuffer = AsciiStrGetNewTokenField (LineBuffer, Char); + ASSERT (FieldBuffer != NULL); if (AsciiStriCmp (FieldBuffer, Name) == 0) { BufferStart = FieldBuffer; CodParseState = EdbEbcCodParseStateSymbolStart;