diff options
author | Leah Neukirchen <leah@vuxu.org> | 2018-11-14 16:03:13 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2018-11-14 16:03:13 +0100 |
commit | 188aeac3e1bf03ad087213a9322c23c62b0fea4f (patch) | |
tree | 53e1e9a3ac52a5e9eb7bf32ef0590dcccf1e4076 | |
parent | 2069a0e913167447d84429d09940897b2ffce07e (diff) | |
download | mblaze-188aeac3e1bf03ad087213a9322c23c62b0fea4f.tar.gz mblaze-188aeac3e1bf03ad087213a9322c23c62b0fea4f.tar.xz mblaze-188aeac3e1bf03ad087213a9322c23c62b0fea4f.zip |
safe_u8putstr: handle NUL bytes
These have length 0, but we still want to progress one byte. Found by duncaen with afl-fuzz.
-rw-r--r-- | safe_u8putstr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/safe_u8putstr.c b/safe_u8putstr.c index 31cdb0b..54cd231 100644 --- a/safe_u8putstr.c +++ b/safe_u8putstr.c @@ -36,6 +36,9 @@ safe_u8putstr(char *s0, size_t l, FILE *stream) } } else if (c < 32 && *s != ' ' && *s != '\t' && *s != '\n' && *s != '\r') { + // NUL + if (l == 0) + l = 1; // C0 fputc(0xe2, stream); fputc(0x90, stream); |