[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/ConverterLib: Fix empty string value issue

Nickle Wang via groups.io posted 1 patch 12 months ago
Failed in applying to current master (apply log)
RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/ConverterLib: Fix empty string value issue
Posted by Nickle Wang via groups.io 12 months ago
allocateDuplicateStr() will not copy input string when input
string is empty string. It returns NULL pointer and creates
assertion in application driver.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
 RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
index 964904a2..02fcb2b2 100644
--- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
+++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
@@ -223,7 +223,7 @@ allocateDuplicateStr (
 {
   RedfishCS_status  Status;
 
-  if ((Str == NULL) || (strlen (Str) == 0)) {
+  if (Str == NULL) {
     *DstBuffer = NULL;
     return RedfishCS_status_success;
   }
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104765): https://edk2.groups.io/g/devel/message/104765
Mute This Topic: https://groups.io/mt/98844375/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/ConverterLib: Fix empty string value issue
Posted by Chang, Abner via groups.io 11 months, 4 weeks ago
[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Friday, May 12, 2023 2:25 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg/ConverterLib: Fix
> empty string value issue
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> allocateDuplicateStr() will not copy input string when input
> string is empty string. It returns NULL pointer and creates
> assertion in application driver.
> 
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> ---
>  RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> index 964904a2..02fcb2b2 100644
> --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> @@ -223,7 +223,7 @@ allocateDuplicateStr (
>  {
>    RedfishCS_status  Status;
> 
> -  if ((Str == NULL) || (strlen (Str) == 0)) {
> +  if (Str == NULL) {
>      *DstBuffer = NULL;
>      return RedfishCS_status_success;
>    }
> --
> 2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104819): https://edk2.groups.io/g/devel/message/104819
Mute This Topic: https://groups.io/mt/98844375/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-