summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Library/BaseLib/SafeString.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c
index 7c1b0758f3..b0e1ce72e2 100644
--- a/MdePkg/Library/BaseLib/SafeString.c
+++ b/MdePkg/Library/BaseLib/SafeString.c
@@ -141,7 +141,7 @@ StrnLenS (
// String then StrnLenS returns MaxSize. At most the first MaxSize characters of String shall
// be accessed by StrnLenS.
//
- for (Length = 0; (*String != 0) && (Length < MaxSize); String++, Length++) {
+ for (Length = 0; (Length < MaxSize) && (*String != 0); String++, Length++) {
;
}
return Length;
@@ -551,7 +551,7 @@ AsciiStrnLenS (
// String then AsciiStrnLenS returns MaxSize. At most the first MaxSize characters of String shall
// be accessed by AsciiStrnLenS.
//
- for (Length = 0; (*String != 0) && (Length < MaxSize); String++, Length++) {
+ for (Length = 0; (Length < MaxSize) && (*String != 0); String++, Length++) {
;
}
return Length;