Skip to content

Commit

Permalink
fix: order properly safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosala committed Nov 2, 2023
1 parent 6fba6d8 commit e71d390
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ utf8_int8_t *c = utf8_null;
size_t bytes = 0;

/* Find the end of the string or stop when n is reached */
while ('\0' != src[bytes] && bytes < n) {
while (bytes < n && '\0' != src[bytes]) {
bytes++;
}

Expand All @@ -722,7 +722,7 @@ return utf8_null;
bytes = 0;

/* copy src byte-by-byte into our new utf8 string */
while ('\0' != src[bytes] && bytes < n) {
while (bytes < n && '\0' != src[bytes]) {
c[bytes] = src[bytes];
bytes++;
}
Expand Down

0 comments on commit e71d390

Please sign in to comment.