diff options
author | hegdenag <nagaraj-p.hegde@hpe.com> | 2017-01-12 11:39:38 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2017-01-13 09:40:48 +0800 |
commit | 521981ee7608b75b51693ea367c9e1d83687d110 (patch) | |
tree | 3cacb9b737a6b86f2953f77819fcb56b47231725 | |
parent | e9f0be021b7649c15d823e193110c0088cda9a89 (diff) | |
download | edk2-platforms-521981ee7608b75b51693ea367c9e1d83687d110.tar.xz |
ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check
When we issue 'ifconfig6 -s <interface> auto' system hangs with
an ASSERT in StrLen. in IfConfig6SetInterfaceInfo, for 'auto' case
we added checks to rule out the invalid inputs like 'host', 'gw'
and 'dns'. To parse through this, we do a VarArg = VarArg->Next but
we dont check new VarArg before calling StrCmp. Fix with a check
in this patch.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
-rw-r--r-- | ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c index d71688ed66..6d8df8031b 100644 --- a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c +++ b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c @@ -1317,20 +1317,21 @@ IfConfig6SetInterfaceInfo ( VarArg= VarArg->Next;
- if (StrCmp (VarArg->Arg, L"host") == 0) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status);
- ShellStatus = SHELL_INVALID_PARAMETER;
- goto ON_EXIT;
- } else if (StrCmp (VarArg->Arg, L"gw") == 0) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status);
- ShellStatus = SHELL_INVALID_PARAMETER;
- goto ON_EXIT;
- } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status);
- ShellStatus = SHELL_INVALID_PARAMETER;
- goto ON_EXIT;
+ if (VarArg != NULL) {
+ if (StrCmp (VarArg->Arg, L"host") == 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_IP_CONFIG), gShellNetwork2HiiHandle, Status);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto ON_EXIT;
+ } else if (StrCmp (VarArg->Arg, L"gw") == 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_GW_CONFIG), gShellNetwork2HiiHandle, Status);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto ON_EXIT;
+ } else if (StrCmp (VarArg->Arg, L"dns") == 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_DNS_CONFIG), gShellNetwork2HiiHandle, Status);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ goto ON_EXIT;
+ }
}
-
} else if (StrCmp (VarArg->Arg, L"man") == 0) {
//
// Set manual config policy.
|