diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-11-24 10:26:06 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-11-25 13:34:17 +0800 |
commit | 12f49354e67df6477a690bf8dd4d919a679da19a (patch) | |
tree | dd0b12017a41b683a2b8ea3f26a9a8eaf047984f /MdeModulePkg/Universal/EbcDxe | |
parent | 0978bd0dc1084b2c1c558244bb247a4194143cc5 (diff) | |
download | edk2-platforms-12f49354e67df6477a690bf8dd4d919a679da19a.tar.xz |
MdeModulePkg/EbcDebugger: Add check for invalid 'CommandArg'
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>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/EbcDxe')
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdBreakpoint.c index 4be6dd42b6..f06963f7d7 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
|