]> diplodocus.org Git - nmh/commitdiff
Protect fileno() call against NULL argument.
authorDavid Levine <levinedl@acm.org>
Sat, 19 Aug 2017 03:18:15 +0000 (23:18 -0400)
committerDavid Levine <levinedl@acm.org>
Sat, 19 Aug 2017 03:18:15 +0000 (23:18 -0400)
Fix to commit 337b4e616e8f53ba06285b1645e1df9918ed5c16.  Thanks to
Norm for reporting and Ken for diagnosing the bug.

uip/mhparse.c

index 74e03a7..7140561 100644 (file)
@@ -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: