history: avoid crashing when the positionlog file is malformed

master
Benno Schulenberg 2016-12-21 17:26:12 +01:00
parent 116d9e6f01
commit 90b959a677
1 changed files with 4 additions and 0 deletions

View File

@ -3192,7 +3192,11 @@ void load_poshistory(void)
/* Find where the x index and line number are in the line. */
xptr = revstrstr(line, " ", line + read - 3);
if (xptr == NULL)
continue;
lineptr = revstrstr(line, " ", xptr - 2);
if (lineptr == NULL)
continue;
/* Now separate the three elements of the line. */
*(xptr++) = '\0';