diff options
| author | Mingjie Shen <shen497@purdue.edu> | 2025-10-31 09:31:00 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-12-03 20:41:35 +0300 |
| commit | ee0084a071b9836cbea07c469483b5f0c10d6abf (patch) | |
| tree | 753f3db7a75e1783348dc8de9ab9271707883ca7 /MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptInternalFormat.h | |
| parent | a058a2856dec7d3e837ca5034fe892c83bc8077e (diff) | |
| download | edk2-ee0084a071b9836cbea07c469483b5f0c10d6abf.tar.xz | |
ShellPkg/Mv: Harden and optimize trailing-slash trimming
- Remove redundant null check in IsValidMove() per CodeQL
cpp/redundant-null-check-simple. Specifically, drop the
"DestPathWalker != NULL" condition from the trimming loop.
Rationale: "DestPathCopy" is allocated at line 181 and checked for
NULL at lines 182–183; "DestPathWalker" is initialized from
"DestPathCopy" at line 186, so it cannot be NULL.
- Cache length once in IsValidMove() and ValidateAndMoveFiles() so the
trimming loop avoids repeated StrLen() calls.
- Guard the zero-length case before indexing the last character to
prevent out-of-bounds access.
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
Diffstat (limited to 'MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptInternalFormat.h')
0 files changed, 0 insertions, 0 deletions
