// The size of the VariableName, including the Unicode Null in bytes plus\r
// the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
//\r
- else if (sizeof (VARIABLE_HEADER) + ArrayLength (VariableName) + DataSize > MAX_VARIABLE_SIZE) {\r
+ else if ((DataSize > MAX_VARIABLE_SIZE) ||\r
+ (sizeof (VARIABLE_HEADER) + ArrayLength (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
//\r