From aa09397b3c62c7b409135ed91edef8bd7bd33a73 Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Fri, 19 Oct 2007 08:49:20 +0000 Subject: Fix a bug in variable driver cache mechanism: It should return EFI_SUCCESS and update the output buffer size if the input buffer is larger than actual variable contents. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4182 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 34bc4a8e15..20eeebe54c 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -676,11 +676,12 @@ FindVariableInCache ( if (Entry->DataSize == 0) { // Variable was deleted so return not found return EFI_NOT_FOUND; - } else if (Entry->DataSize != *DataSize) { + } else if (Entry->DataSize > *DataSize) { // If the buffer is too small return correct size *DataSize = Entry->DataSize; return EFI_BUFFER_TOO_SMALL; } else { + *DataSize = Entry->DataSize; // Return the data CopyMem (Data, Entry->Data, Entry->DataSize); if (Attributes != NULL) { -- cgit v1.2.3