From 188aeac3e1bf03ad087213a9322c23c62b0fea4f Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Wed, 14 Nov 2018 16:03:13 +0100 Subject: safe_u8putstr: handle NUL bytes These have length 0, but we still want to progress one byte. Found by duncaen with afl-fuzz. --- safe_u8putstr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'safe_u8putstr.c') 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); -- cgit 1.4.1