From f6b9dc7d681390c0cbd4319053c9a59d1fd8a8fc Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 21 Jan 2019 11:54:03 +0200 Subject: [PATCH] Don't try to write a zero-length message If the message history contains a zero-length message line, skip it, as trying to write a zero-length string will make bwrite panic. Happened only on X11. This is post-3.6.1 bug. --- src/save.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/save.c b/src/save.c index 18465966d..75c1b1fd8 100644 --- a/src/save.c +++ b/src/save.c @@ -1240,6 +1240,8 @@ int fd, mode; while ((msg = getmsghistory(init)) != 0) { init = FALSE; msglen = strlen(msg); + if (msglen < 1) + continue; /* sanity: truncate if necessary (shouldn't happen); no need to modify msg[] since terminator isn't written */ if (msglen > BUFSZ - 1)