# HG changeset patch # User Mikael Berthe # Date 1380444282 -7200 # Node ID 990cad5123f36b8cf3119c151a0b47cb65670c7f # Parent 0722fe4b758038a7442f72f57983c954ef578082 Try to recover when a history log file is damaged Mcabber used to hang when a history file contained NUL characters. Thanks to nedko for the report. diff -r 0722fe4b7580 -r 990cad5123f3 mcabber/mcabber/histolog.c --- a/mcabber/mcabber/histolog.c Sun Sep 29 10:24:24 2013 +0200 +++ b/mcabber/mcabber/histolog.c Sun Sep 29 10:44:42 2013 +0200 @@ -229,6 +229,12 @@ while (1) { for (tail = data; *tail; tail++) ; + if (tail == data) { + // That would happen if the log file has NUL characters... + scr_LogPrint(LPRINT_LOGNORM, "Corrupted history file! Trying to recover."); + err = 1; + break; + } noeol = (*(tail-1) != '\n'); if (!noeol) break;