From 31418015ee960e0803f70d5534962897ee8a7a21 Mon Sep 17 00:00:00 2001 From: Dave Anderson Date: Mon, 1 Apr 2019 11:56:41 -0400 Subject: [PATCH] When the is_s390_dump() function is called to determine whether a file is an s390 dumpfile, it currently presumes that the fopen() call always works, and then tries to read it with using a NULL file pointer. Change it to verify that the fopen() was successful, and if not, print an error message as is done with the other dumpfile type verifier functions. (ramin.blackhat@gmail.com) --- s390_dump.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/s390_dump.c b/s390_dump.c index 1df7fd3..d30ecf0 100644 --- a/s390_dump.c +++ b/s390_dump.c @@ -30,6 +30,10 @@ is_s390_dump(char *file) int rc; fh = fopen(file,"r"); + if (fh == NULL) { + error(INFO, "is_s390_dump: cannot open %s: %s\n", file); + return FALSE; + } items = fread(&magic, sizeof(magic), 1,fh); if(magic == 0xa8190173618f23fdLL) rc = TRUE;