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.
Cc: Fu Siyuan <siyuan...@intel.com> Cc: Ye Ting <ting...@intel.com> Cc: Wu Jiaxin <jiaxin...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a...@intel.com> --- MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c index 0865ddd..0779056 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); } } -- 1.9.5.msysgit.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel