From f20076daaf8509e815a37fd0cb5453b9c3b9a79d Mon Sep 17 00:00:00 2001 From: jcarsey Date: Tue, 19 Apr 2011 16:55:51 +0000 Subject: [PATCH] fix user input validation for time command. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11567 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c index 780b39e2fd..abefee3f3a 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c @@ -298,7 +298,7 @@ CheckAndSetTime ( if (TimeString != NULL && !InternalIsTimeLikeString(TimeString, L':', 1, 2, FALSE)) { return (SHELL_INVALID_PARAMETER); } - if (((Daylight & (EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT)) != Daylight)) { + if (Daylight != 0xFF &&((Daylight & (EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT)) != Daylight)) { return (SHELL_INVALID_PARAMETER); } @@ -341,7 +341,9 @@ CheckAndSetTime ( TheTime.TimeZone = Tz; } - TheTime.Daylight = Daylight; + if (Daylight != 0xFF) { + TheTime.Daylight = Daylight; + } Status = gRT->SetTime(&TheTime);