Mercurial > hg
changeset 2073:990cad5123f3
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.
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 29 Sep 2013 10:44:42 +0200 |
parents | 0722fe4b7580 |
children | e04b6dfbb054 |
files | mcabber/mcabber/histolog.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;