[edk2-devel] [PATCH] EmulatorPkg/PosixFileSystem: Add NULL check on memory allocation

Miki Shindo posted 1 patch 1 year, 9 months ago
Failed in applying to current master (apply log)
EmulatorPkg/Unix/Host/PosixFileSystem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel] [PATCH] EmulatorPkg/PosixFileSystem: Add NULL check on memory allocation
Posted by Miki Shindo 1 year, 9 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4001

This commit adds NULL check on memory allocation of the size
for FileName in ASCII string format at PosixFileSetInfo().

Signed-off-by: Miki Shindo <miki.shindo@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
---
 EmulatorPkg/Unix/Host/PosixFileSystem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/EmulatorPkg/Unix/Host/PosixFileSystem.c b/EmulatorPkg/Unix/Host/PosixFileSystem.c
index ae3fe72a05..b69d3d5520 100644
--- a/EmulatorPkg/Unix/Host/PosixFileSystem.c
+++ b/EmulatorPkg/Unix/Host/PosixFileSystem.c
@@ -1187,7 +1187,7 @@ PosixFileSetInfo (
   }
 
   OldFileName = malloc (AsciiStrSize (PrivateFile->FileName));
-  if (OldFileInfo == NULL) {
+  if (OldFileName == NULL) {
     goto Done;
   }
 
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91553): https://edk2.groups.io/g/devel/message/91553
Mute This Topic: https://groups.io/mt/92491604/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] EmulatorPkg/PosixFileSystem: Add NULL check on memory allocation
Posted by Ni, Ray 1 year, 9 months ago
Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Shindo, Miki <miki.shindo@intel.com>
> Sent: Wednesday, July 20, 2022 4:28 AM
> To: devel@edk2.groups.io
> Cc: Andrew Fish <afish@apple.com>; Ni, Ray <ray.ni@intel.com>
> Subject: [PATCH] EmulatorPkg/PosixFileSystem: Add NULL check on memory
> allocation
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4001
> 
> This commit adds NULL check on memory allocation of the size
> for FileName in ASCII string format at PosixFileSetInfo().
> 
> Signed-off-by: Miki Shindo <miki.shindo@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> ---
>  EmulatorPkg/Unix/Host/PosixFileSystem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/EmulatorPkg/Unix/Host/PosixFileSystem.c
> b/EmulatorPkg/Unix/Host/PosixFileSystem.c
> index ae3fe72a05..b69d3d5520 100644
> --- a/EmulatorPkg/Unix/Host/PosixFileSystem.c
> +++ b/EmulatorPkg/Unix/Host/PosixFileSystem.c
> @@ -1187,7 +1187,7 @@ PosixFileSetInfo (
>    }
> 
> 
> 
>    OldFileName = malloc (AsciiStrSize (PrivateFile->FileName));
> 
> -  if (OldFileInfo == NULL) {
> 
> +  if (OldFileName == NULL) {
> 
>      goto Done;
> 
>    }
> 
> 
> 
> --
> 2.27.0.windows.1



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