* Re: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check
2017-01-12 3:39 [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check hegdenag
@ 2017-01-12 3:46 ` Zhang, Lubo
2017-01-12 9:31 ` Wu, Jiaxin
2017-01-12 14:39 ` Subramanian, Sriram
2 siblings, 0 replies; 5+ messages in thread
From: Zhang, Lubo @ 2017-01-12 3:46 UTC (permalink / raw)
To: hegdenag, edk2-devel@lists.01.org
Cc: Wu, Jiaxin, Carsey, Jaben, Ni, Ruiyu, sriram-s@hpe.com
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
> -----Original Message-----
> From: hegdenag [mailto:nagaraj-p.hegde@hpe.com]
> Sent: Thursday, January 12, 2017 11:40 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> Ni, Ruiyu <ruiyu.ni@intel.com>; Zhang, Lubo <lubo.zhang@intel.com>; sriram-
> s@hpe.com
> Subject: [PATCH v1 1/1] 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>
> ---
> ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 27
> ++++++++++----------
> 1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> index d71688e..72aaee4 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.
> --
> 2.8.3.windows.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check
2017-01-12 3:39 [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check hegdenag
2017-01-12 3:46 ` Zhang, Lubo
@ 2017-01-12 9:31 ` Wu, Jiaxin
2017-01-12 14:39 ` Subramanian, Sriram
2 siblings, 0 replies; 5+ messages in thread
From: Wu, Jiaxin @ 2017-01-12 9:31 UTC (permalink / raw)
To: hegdenag, edk2-devel@lists.01.org
Cc: Carsey, Jaben, Ni, Ruiyu, Zhang, Lubo, sriram-s@hpe.com
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
> -----Original Message-----
> From: hegdenag [mailto:nagaraj-p.hegde@hpe.com]
> Sent: Thursday, January 12, 2017 11:40 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> Ni, Ruiyu <ruiyu.ni@intel.com>; Zhang, Lubo <lubo.zhang@intel.com>; sriram-
> s@hpe.com
> Subject: [PATCH v1 1/1] 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>
> ---
> ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 27
> ++++++++++----------
> 1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> index d71688e..72aaee4 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.
> --
> 2.8.3.windows.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check
2017-01-12 3:39 [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check hegdenag
2017-01-12 3:46 ` Zhang, Lubo
2017-01-12 9:31 ` Wu, Jiaxin
@ 2017-01-12 14:39 ` Subramanian, Sriram
2017-01-13 1:43 ` Wu, Jiaxin
2 siblings, 1 reply; 5+ messages in thread
From: Subramanian, Sriram @ 2017-01-12 14:39 UTC (permalink / raw)
To: Hegde, Nagaraj P, edk2-devel@lists.01.org
Cc: jiaxin.wu@intel.com, jaben.carsey@intel.com, ruiyu.ni@intel.com,
lubo.zhang@intel.com
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
-----Original Message-----
From: Hegde, Nagaraj P
Sent: Thursday, January 12, 2017 9:10 AM
To: edk2-devel@lists.01.org
Cc: jiaxin.wu@intel.com; jaben.carsey@intel.com; ruiyu.ni@intel.com; lubo.zhang@intel.com; Subramanian, Sriram <sriram-s@hpe.com>
Subject: [PATCH v1 1/1] 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>
---
ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 27 ++++++++++----------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
index d71688e..72aaee4 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.
--
2.8.3.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a missing NULL check
2017-01-12 14:39 ` Subramanian, Sriram
@ 2017-01-13 1:43 ` Wu, Jiaxin
0 siblings, 0 replies; 5+ messages in thread
From: Wu, Jiaxin @ 2017-01-13 1:43 UTC (permalink / raw)
To: Subramanian, Sriram, Hegde, Nagaraj P, edk2-devel@lists.01.org
Cc: Carsey, Jaben, Ni, Ruiyu, Zhang, Lubo
Commit:
https://github.com/tianocore/edk2/commit/521981ee7608b75b51693ea367c9e1d83687d110
Thanks,
Jiaxin
> -----Original Message-----
> From: Subramanian, Sriram [mailto:sriram-s@hpe.com]
> Sent: Thursday, January 12, 2017 10:40 PM
> To: Hegde, Nagaraj P <nagaraj-p.hegde@hpe.com>; edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Carsey, Jaben <jaben.carsey@intel.com>;
> Ni, Ruiyu <ruiyu.ni@intel.com>; Zhang, Lubo <lubo.zhang@intel.com>
> Subject: RE: [PATCH v1 1/1] ShellPkg/Ifconfig6: Address ASSERT because of a
> missing NULL check
>
> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
>
> -----Original Message-----
> From: Hegde, Nagaraj P
> Sent: Thursday, January 12, 2017 9:10 AM
> To: edk2-devel@lists.01.org
> Cc: jiaxin.wu@intel.com; jaben.carsey@intel.com; ruiyu.ni@intel.com;
> lubo.zhang@intel.com; Subramanian, Sriram <sriram-s@hpe.com>
> Subject: [PATCH v1 1/1] 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>
> ---
> ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c | 27
> ++++++++++----------
> 1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> b/ShellPkg/Library/UefiShellNetwork2CommandsLib/Ifconfig6.c
> index d71688e..72aaee4 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.
> --
> 2.8.3.windows.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread