diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-22 19:25:08 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-12-22 19:25:08 +1300 |
commit | f602816cdd6278b098011dcb136818ba99ecfec9 (patch) | |
tree | 947f0d7afcb8f852533b1926792dc7cddfcaf051 /wtf8.c | |
parent | Merge branch 'release/v1.2.0' (diff) | |
parent | Bump VERSION (diff) | |
download | wtf8-f602816cdd6278b098011dcb136818ba99ecfec9.tar.gz wtf8-f602816cdd6278b098011dcb136818ba99ecfec9.zip |
Merge branch 'hotfix/v1.2.1'v1.2.1
* hotfix/v1.2.1:
Bounds checking on character byte walk
Diffstat (limited to 'wtf8.c')
-rw-r--r-- | wtf8.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -35,7 +35,7 @@ void print_characters(char *s) { /* * We need a short counter to find how long each character is */ - int c; + unsigned char c; /* * Iterate through the string @@ -46,7 +46,7 @@ void print_characters(char *s) { * Print blanks and increment a counter until we find how long this * character is */ - for (c = 1; is_utf8_cont(s[c]); c++) + for (c = 1; is_utf8_cont(s[c]) && c <= UCHAR_MAX; c++) printf(" "); /* |