[PATCH v2 3/3] OvmfPkg/VirtioFsDxe: Check GetDriverName arguments


Dimitrije Pavlov
 

The current implementation does not check if Language or DriverName
are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Cc: Ard Biesheuvel <ardb+tianocore@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Liming Gao <gaoliming@...>
Cc: Sunny Wang <Sunny.Wang@...>
Cc: Jeff Booher-Kaeding <Jeff.Booher-Kaeding@...>
Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@...>

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@...>
---
OvmfPkg/VirtioFsDxe/DriverBinding.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/OvmfPkg/VirtioFsDxe/DriverBinding.c b/OvmfPkg/VirtioFsDxe/Dr=
iverBinding.c
index 86eb9cf0ba51..3d80ff0f91f5 100644
--- a/OvmfPkg/VirtioFsDxe/DriverBinding.c
+++ b/OvmfPkg/VirtioFsDxe/DriverBinding.c
@@ -218,6 +218,10 @@ VirtioFsGetDriverName (
OUT CHAR16 **DriverName
)
{
+ if (Language =3D=3D NULL || DriverName =3D=3D NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
if (AsciiStrCmp (Language, "en") !=3D 0) {
return EFI_UNSUPPORTED;
}
--=20
2.37.2