linter: don't try to access absent stat info, as that gives a crash

This fixes https://savannah.gnu.org/bugs/?53981.
master
Benno Schulenberg 2018-05-25 19:25:11 +02:00
parent 86c08560ad
commit ac31669ec3
1 changed files with 6 additions and 4 deletions

View File

@ -3267,16 +3267,18 @@ void do_linter(void)
struct stat lintfileinfo;
if (stat(curlint->filename, &lintfileinfo) != -1 &&
openfile->current_stat->st_ino != lintfileinfo.st_ino) {
(openfile->current_stat == NULL ||
openfile->current_stat->st_ino != lintfileinfo.st_ino)) {
#ifdef ENABLE_MULTIBUFFER
const openfilestruct *started_at = openfile;
openfile = openfile->next;
while (openfile != started_at &&
openfile->current_stat->st_ino != lintfileinfo.st_ino)
while (openfile != started_at && (openfile->current_stat == NULL ||
openfile->current_stat->st_ino != lintfileinfo.st_ino))
openfile = openfile->next;
if (openfile->current_stat->st_ino != lintfileinfo.st_ino) {
if (openfile->current_stat == NULL ||
openfile->current_stat->st_ino != lintfileinfo.st_ino) {
char *msg = charalloc(1024 + strlen(curlint->filename));
int i;