On 19 Mar 2001, Mark Lipscombe wrote:


>       open ($FH, $fname);
...
>       $r->send_fd($FH);

you didn't check the return value of open();  patch below will check if
the filehandle is NULL and croak rather than segfault.

Index: src/modules/perl/Apache.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.122
diff -u -r1.122 Apache.xs
--- src/modules/perl/Apache.xs  2001/06/14 04:36:21     1.122
+++ src/modules/perl/Apache.xs  2001/06/14 05:24:25
@@ -956,6 +956,10 @@
     long length
 
     CODE:
+    if (!f) {
+        croak("send_fd: NULL filehandle "
+              "(hint: did you check the return value of open?)");
+    }
     RETVAL = send_fd_length(f, r, length);
 
     OUTPUT:

Reply via email to