From: David Levine Date: Sat, 19 Aug 2017 03:18:15 +0000 (-0400) Subject: Protect fileno() call against NULL argument. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/c8815b7b63b710e1480d4be759744583e59308e9 Protect fileno() call against NULL argument. Fix to commit 337b4e616e8f53ba06285b1645e1df9918ed5c16. Thanks to Norm for reporting and Ken for diagnosing the bug. --- diff --git a/uip/mhparse.c b/uip/mhparse.c index 74e03a7e..71405616 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -2340,7 +2340,7 @@ openExternal (CT ct, CT cb, CE ce, char **file, int *fd) admonish (cachefile, "unable to fopen for reading"); } - *fd = fileno (ce->ce_fp); + *fd = ce->ce_fp ? fileno (ce->ce_fp) : -1; return OK; ready_already: