From 2f33ebae655a7f6189f10c7676d8fc870f706afe Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 7 Sep 2021 16:26:06 +0200 Subject: load_cell_from_file: Check fgets return value for first line --- libcrystfel/src/cell-utils.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libcrystfel') diff --git a/libcrystfel/src/cell-utils.c b/libcrystfel/src/cell-utils.c index 5131fb20..2398c5f2 100644 --- a/libcrystfel/src/cell-utils.c +++ b/libcrystfel/src/cell-utils.c @@ -971,6 +971,11 @@ UnitCell *load_cell_from_file(const char *filename) } rval = fgets(line, 1023, fh); + if ( rval == NULL ) { + ERROR("Failed to read first line from cell file\n"); + fclose(fh); + return NULL; + } chomp(line); if ( strcmp(line, "CrystFEL unit cell file version 1.0") != 0 ) { -- cgit v1.2.3