diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-11-15 16:12:30 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-12-22 16:17:21 +0800 |
commit | 81a108434041f6bed629123922772279d98d91a8 (patch) | |
tree | 5c7df89036d4db6b54198b1a969807035a600424 /MdeModulePkg/Universal | |
parent | 69e856dfa56cebfba1abf160f3c86458dde850d4 (diff) | |
download | edk2-platforms-81a108434041f6bed629123922772279d98d91a8.tar.xz |
MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic
This commit refines the logic for the CvtNum function. It avoids using the
decrement operator '--' for array index to prevent possible mis-reports by
static code checkers.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c index 0865ddd7cd..077905671e 100644 --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c @@ -132,11 +132,10 @@ CvtNum ( {
UINTN Remainder;
- while (Length > 0) {
+ for (; Length > 0; Length--) {
Remainder = Number % 10;
Number /= 10;
- Length--;
- Buffer[Length] = (UINT8) ('0' + Remainder);
+ Buffer[Length - 1] = (UINT8) ('0' + Remainder);
}
}
|