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
This commit is contained in:
qhuang8 2007-10-19 08:49:20 +00:00
parent ad4dc92d61
commit aa09397b3c
1 changed files with 2 additions and 1 deletions

View File

@ -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) {