diff options
author | Jaben Carsey <jaben.carsey@intel.com> | 2014-08-29 21:57:42 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-29 21:57:42 +0000 |
commit | 99ab5fc36c544e0b6294bcf40dcada5d76ac2792 (patch) | |
tree | 4e24afbb9f52c583ae5bbf26d786e3aae8b849d7 /ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c | |
parent | 531733377ac25083c7a54067a5330fb59f79bdfd (diff) | |
download | edk2-99ab5fc36c544e0b6294bcf40dcada5d76ac2792.tar.gz edk2-99ab5fc36c544e0b6294bcf40dcada5d76ac2792.tar.bz2 edk2-99ab5fc36c544e0b6294bcf40dcada5d76ac2792.zip |
This patch replaces StrCpy with StrnCpy or refactors out the usage of StrCpy through some other means.
This patch replaces StrCat with StrnCat or refactors out the usage of StrCat through some other means.
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>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16004 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c')
-rw-r--r-- | ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c index be8b7c6c53..700592d263 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c @@ -2,7 +2,7 @@ Build a table, each item is (Key, Info) pair.
And give a interface of query a string out of a table.
- Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -3214,25 +3214,20 @@ QueryTable ( for (Index = 0; Index < Number; Index++) {
High = (UINT8) (Table[Index].Key >> 8);
Low = (UINT8) (Table[Index].Key & 0x00FF);
+
//
// Check if Key is in the range
+ // or if Key == Value in the table
//
- if (High > Low && Key >= Low && Key <= High) {
- StrnCpy (Info, Table[Index].Info, InfoLen-1);
- StrnCat (Info, L"\n", InfoLen - StrLen(Info));
- return Key;
- }
- //
- // Check if Key == Value in the table
- //
- if (Table[Index].Key == Key) {
+ if ((High > Low && Key >= Low && Key <= High)
+ || (Table[Index].Key == Key)) {
StrnCpy (Info, Table[Index].Info, InfoLen-1);
- StrnCat (Info, L"\n", InfoLen - StrLen(Info));
+ StrnCat (Info, L"\n", InfoLen - 1 - StrLen(Info));
return Key;
}
}
- StrnCpy (Info, L"Undefined Value\n", InfoLen);
+ StrnCpy (Info, L"Undefined Value\n", InfoLen - 1);
return QUERY_TABLE_UNFOUND;
}
|