From 2ba5e2c66007d66c40b37af63e76d6fe1596a6a3 Mon Sep 17 00:00:00 2001 From: Martin Mitas Date: Wed, 17 Jan 2024 14:48:57 +0100 Subject: [PATCH] Make --replay-fuzz friendlier to work with in debugger. We make effectively input zero-terminated so debugger doesn't attempt to write more than what's really provided. --- md2html/md2html.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/md2html/md2html.c b/md2html/md2html.c index 39d35016..93763000 100644 --- a/md2html/md2html.c +++ b/md2html/md2html.c @@ -160,6 +160,10 @@ process_file(const char* in_path, FILE* in, FILE* out) memmove(buf_in.data, buf_in.data + 2 * sizeof(unsigned), buf_in.size - 2 * sizeof(unsigned)); buf_in.size -= 2 * sizeof(unsigned); + + /* Zero the tail we have moved the contents from. + * It helps in debugging if make it actually a zero-terminated string. */ + memset(buf_in.data + buf_in.size, 0, 2 * sizeof(unsigned)); } /* Parse the document. This shall call our callbacks provided via the