]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DuetPkg FSVariable: return error for empty str VariableName to GetVariable
authorStar Zeng <star.zeng@intel.com>
Fri, 13 May 2016 05:01:28 +0000 (13:01 +0800)
committerStar Zeng <star.zeng@intel.com>
Sun, 15 May 2016 09:48:53 +0000 (17:48 +0800)
Current GetVariable implementation will return the first variable for
empty str VariableName, it is because GetVariable and GetNextVariablename
are sharing same function FindVariable.
But UEFI sepc defines SetVariable that If VariableName is an empty string,
then EFI_INVALID_PARAMETER is returned, that means an empty string variable
could never be set successfully, so GetVariable should return error for
empty string VariableName.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
DuetPkg/FSVariable/FSVariable.c

index 06df161e5debdd6beb3eb9228a220f0c29a35b94..34b79305c87112b401dae7692a850029162e9ec2 100644 (file)
@@ -1337,6 +1337,10 @@ Returns:
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  if (VariableName[0] == 0) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
   //\r
   // Find existing variable\r
   //\r