audk/ShellPkg/Library/UefiShellDebug1CommandsLib
Laszlo Ersek bbf57d4fb9 ShellPkg: UefiShellDebug1CommandsLib: fix hex string parsing in SETVAR
The ShellCommandRunSetVar() function calls the ShellIsHexOrDecimalNumber()
UefiShellLib function to determine if the data string in the SETVAR
command is a string of hexadecimal bytes.

However, ShellIsHexOrDecimalNumber() calls ShellConvertStringToUint64()
for validation. Therefore SETVAR rejects hex strings that cannot be
interpreted as UINT64 values due to range errors, despite the fact that
the hexadecimal data string of the SETVAR command is supposed to describe
an arbitrary array of bytes, rather than UINT64 values.

The internal library function InternalShellIsHexOrDecimalNumber() comes
close, as the first idea for the fix, however it is not quite right
either; it removes a leading minus sign, plus it allows 0x / 0X prefixes.
This would not be correct for the SETVAR command.

Instead, add a trivial utility function that is specific to the SETVAR
implementation. IsStringOfHexNibbles() accepts empty strings for
simplicity, but where we call it we have already ensured that the data
string is not empty (because that is handled earlier by the "delete
variable" branch of SETVAR). An even number of nibbles is also enforced
near the call site.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17128 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-07 14:18:40 +00:00
..
Edit ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
HexEdit ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
SmbiosView ShellPkg: Added newline at the end of source files 2015-04-02 11:32:32 +00:00
Comp.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Compress.c ShellPkg: Add missing header files 2014-02-25 23:03:17 +00:00
Compress.h Refine comments and two code style. 2011-09-02 08:05:34 +00:00
Dblk.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Dmem.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
DmpStore.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
EditInputBar.c ShellPkg: Fix calls to SimpleTextOut->SetAttribute to not use reserved bits 2014-07-25 18:46:23 +00:00
EditInputBar.h add Edit and Hexedit shared features. 2011-03-25 21:15:26 +00:00
EditMenuBar.c ShellPkg: Added the Ctrl based hot key and changed text editor's UI. 2011-07-20 20:10:45 +00:00
EditMenuBar.h ShellPkg: Added the Ctrl based hot key and changed text editor's UI. 2011-07-20 20:10:45 +00:00
EditStatusBar.c ShellPkg: Fix calls to SimpleTextOut->SetAttribute to not use reserved bits 2014-07-25 18:46:23 +00:00
EditStatusBar.h add Edit and Hexedit shared features. 2011-03-25 21:15:26 +00:00
EditTitleBar.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
EditTitleBar.h smbiosview - add user input verification. 2011-03-29 19:31:18 +00:00
EfiCompress.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
EfiDecompress.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
LoadPciRom.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
MemMap.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Mm.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Mode.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Pci.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
Pci.h ShellPkg: fix typo. 2014-07-28 16:58:34 +00:00
SerMode.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
SetSize.c ShellPkg: Standardized HP Copyright Message String 2015-02-04 22:25:01 +00:00
SetVar.c ShellPkg: UefiShellDebug1CommandsLib: fix hex string parsing in SETVAR 2015-04-07 14:18:40 +00:00
UefiShellDebug1CommandsLib.c ShellPkg: Use the new library for "bcfg" command 2014-09-10 20:55:37 +00:00
UefiShellDebug1CommandsLib.h Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib. 2013-07-26 03:14:08 +00:00
UefiShellDebug1CommandsLib.inf ShellPkg: update smbiosview for SMBIOS 3.0. 2015-03-17 08:12:59 +00:00
UefiShellDebug1CommandsLib.uni ShellPkg: UefiShellDebug1CommandsLib: fix SETVAR option summary 2015-04-07 14:18:35 +00:00