From f0a3b1a221ad8a678de18fb8ad9e2a6ba8112093 Mon Sep 17 00:00:00 2001 From: klu2 Date: Tue, 23 Jun 2009 08:42:38 +0000 Subject: Add more checking to avoid the buffer overflow. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8626 6f19259b-4bc3-4df7-8a09-765794883524 --- IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'IntelFrameworkModulePkg/Library') diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c index bc8de582f6..0eadec9fe7 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c @@ -41,6 +41,10 @@ IsNvNeed ( Ptr++; } + if ((((UINTN)Ptr - (UINTN)ConVarName) / sizeof (CHAR16)) <= 3) { + return TRUE; + } + if ((*(Ptr - 3) == 'D') && (*(Ptr - 2) == 'e') && (*(Ptr - 1) == 'v')) { return FALSE; } else { -- cgit v1.2.3