/** @file\r
Main file for SetVar shell Debug1 function.\r
\r
- Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>\r
+ (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
{NULL, TypeMax}\r
};\r
\r
+\r
+/**\r
+ Check if the input is a (potentially empty) string of hexadecimal nibbles.\r
+\r
+ @param[in] String The CHAR16 string to check.\r
+\r
+ @retval FALSE A character has been found in String for which\r
+ ShellIsHexaDecimalDigitCharacter() returned FALSE.\r
+\r
+ @retval TRUE Otherwise. (Note that this covers the case when String is\r
+ empty.)\r
+**/\r
+BOOLEAN\r
+IsStringOfHexNibbles (\r
+ IN CONST CHAR16 *String\r
+ )\r
+{\r
+ CONST CHAR16 *Pos;\r
+\r
+ for (Pos = String; *Pos != L'\0'; ++Pos) {\r
+ if (!ShellIsHexaDecimalDigitCharacter (*Pos)) {\r
+ return FALSE;\r
+ }\r
+ }\r
+ return TRUE;\r
+}\r
+\r
+\r
/**\r
Function for 'setvar' command.\r
\r
\r
ASSERT(Data[0] == L'=');\r
Data++;\r
+ ASSERT(Data[0] != L'\0');\r
\r
//\r
// Determine if the variable exists and get the attributes\r
//\r
// What type is the new data.\r
//\r
- if (ShellIsHexOrDecimalNumber(Data, TRUE, FALSE)) {\r
+ if (IsStringOfHexNibbles(Data)) {\r
if (StrLen(Data) % 2 != 0) {\r
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle, L"setvar", Data); \r
ShellStatus = SHELL_INVALID_PARAMETER;\r