From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Jiewen Yao <jiewen.yao@intel.com>
Subject: [PATCH 2/5] MdeModulePkg/EbcDebugger: Add check for invalid 'CommandArg'
Date: Thu, 24 Nov 2016 10:56:32 +0800 [thread overview]
Message-ID: <1479956195-10764-3-git-send-email-hao.a.wu@intel.com> (raw)
In-Reply-To: <1479956195-10764-1-git-send-email-hao.a.wu@intel.com>
Add checks for the return value of function Atoi() in EdbCmdBreakpoint.c.
If the input parameter 'CommandArg' contains non-digit character, print
corresponding error message.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
.../Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
index 4be6dd4..f06963f 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.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
@@ -461,6 +461,10 @@ Returns:
// Get breakpoint index
//
Index = Atoi(CommandArg);
+ if (Index == (UINTN) -1) {
+ EDBPrint (L"BreakpointClear Argument error!\n");
+ return EFI_DEBUG_CONTINUE;
+ }
if ((Index >= EFI_DEBUGGER_BREAKPOINT_MAX) ||
(Index >= DebuggerPrivate->DebuggerBreakpointCount)) {
@@ -534,6 +538,10 @@ Returns:
// Get breakpoint index
//
Index = Atoi(CommandArg);
+ if (Index == (UINTN) -1) {
+ EDBPrint (L"BreakpointDisable Argument error!\n");
+ return EFI_DEBUG_CONTINUE;
+ }
//
// Disable breakpoint
@@ -598,6 +606,10 @@ Returns:
// Get breakpoint index
//
Index = Atoi(CommandArg);
+ if (Index == (UINTN) -1) {
+ EDBPrint (L"BreakpointEnable Argument error!\n");
+ return EFI_DEBUG_CONTINUE;
+ }
//
// Enable breakpoint
--
1.9.5.msysgit.0
next prev parent reply other threads:[~2016-11-24 2:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 2:56 [PATCH 0/5] Code refinements in MdeModulePkg/EbcDebugger Hao Wu
2016-11-24 2:56 ` [PATCH 1/5] MdeModulePkg/EbcDebugger: Operands of same size for bitwise operation Hao Wu
2016-11-24 2:56 ` Hao Wu [this message]
2016-11-24 2:56 ` [PATCH 3/5] MdeModulePkg/EbcDebugger: Add missing check for symbol not found Hao Wu
2016-11-24 2:56 ` [PATCH 4/5] MdeModulePkg/EbcDebugger: Add ASSERT to ensure FieldBuffer is not NULL Hao Wu
2016-11-24 2:56 ` [PATCH 5/5] MdeModulePkg/EbcDebugger: Compare ASCII char with '\0' Hao Wu
2016-11-24 3:12 ` [PATCH 0/5] Code refinements in MdeModulePkg/EbcDebugger Yao, Jiewen
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=1479956195-10764-3-git-send-email-hao.a.wu@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