Commit Graph

11 Commits

Author SHA1 Message Date
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
Tapan Shah c011b6c9e2 ShellPkg: Standardized HP Copyright Message String
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16759 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-04 22:25:01 +00:00
Tapan Shah 4092a8f6d0 ShellPkg: Update Debug1 profile commands response output
Updates to Debug1 profile commands response output. 
Updating Debug1 profile commands source code to include command name as a prefix in error message.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16729 6f19259b-4bc3-4df7-8a09-765794883524
2015-02-03 21:22:53 +00:00
Jaben Carsey 475387e9de ShellPkg: Update SetVar to use existing attributes for updating existing variables.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16194 6f19259b-4bc3-4df7-8a09-765794883524
2014-10-02 16:41:28 +00:00
Brendan Jackman 0698723204 ShellPkg: ShellCommands/SetVar: Make '-rt' imply '-bs'
It's invalid to set a variable that's available from runtime services but not
from boot services.

Currently if you pass '-rt' without '-bs' you get a generic
'Invalid Parameter' message. We should either print a more useful message in
this case, or make '-rt' imply '-bs' (as this patch does). The Shell Spec is
ambiguous on the matter.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brendan Jackman <Brendan.Jackman@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
Reviewed-By: Jaben Carsey <jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15323 6f19259b-4bc3-4df7-8a09-765794883524
2014-03-10 18:13:13 +00:00
Sergei Antonov 6b6aa6d136 ShellPkg: Handle pool allocation failure
If AllocateZeroPool() returns NULL,
GetVariable() will return EFI_BUFFER_TOO_SMALL,
FreePool() will receive NULL.
So check for NULL before FreePool().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14688 6f19259b-4bc3-4df7-8a09-765794883524
2013-09-19 17:23:10 +00:00
Ruiyu Ni 863986b3c8 Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14505 6f19259b-4bc3-4df7-8a09-765794883524
2013-07-26 03:14:08 +00:00
jcarsey cbdd109b43 check memory allocations for success.
check pointer before access.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11503 6f19259b-4bc3-4df7-8a09-765794883524
2011-04-04 21:41:24 +00:00
jcarsey 33c031ee20 pointer verification (not NULL) and buffer overrun fixes.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11459 6f19259b-4bc3-4df7-8a09-765794883524
2011-03-30 19:33:03 +00:00
jcarsey 3737ac2bc3 comp - add comments and add input verification
bcfg - updated for bugs.
compress - rename for coding standards. add comments.
dblk - add comments, input verification, and a header line
dmem - add comments, add input verification, add system table info
dmpstore - add comments
eficompress - add comments and add input verification 
efidecompress - add comments and add input verification 
loadpcirom - add comments and more output messages
memmap - add more output to exceed the spec.
mm - move functions, add comments, add input verification.
mode - add comment
pci - add input verification.
SerMode - add comments and add input verification 
setsize - add comments and add input verification 
setvar - add comments and add input verification 
smbiosview - add input verification.

clarify error messages.


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11438 6f19259b-4bc3-4df7-8a09-765794883524
2011-03-25 21:22:20 +00:00
jcarsey 5d73d92f56 Add "Debug1" profile (all but Edit and HexEdit commands)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11068 6f19259b-4bc3-4df7-8a09-765794883524
2010-11-16 22:36:37 +00:00