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.
This commit is contained in:
Pasi Kallinen
2019-01-21 11:54:03 +02:00
parent 77bc07f579
commit f6b9dc7d68

View File

@@ -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)