www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neale Ferguson <Neale.Fergu...@SoftwareAG-usa.coom>
Subject os-linux/9712: Sendfile fails due to incorrect hdrbytes declaration
Date Mon, 04 Feb 2002 17:36:23 GMT

>Number:         9712
>Category:       os-linux
>Synopsis:       Sendfile fails due to incorrect hdrbytes declaration
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Feb 04 09:40:00 PST 2002
>Originator:     Neale.Ferguson@SoftwareAG-usa.coom
>Release:        2.0.28
Linux for z/Series (64-bit IBM S/390)
When sending the headers during a sendfile request, the Linux code for apr_sendfile() within
sendrecv.c calls apr_sendv() to send the headers. It passes the address of the variable hdrbytes
(defined as apr_int32_t) to the routine which is expecting apr_size_t. On a 32-bit system
this works fine, but results in the value 0 (the top 32 bits of the 64 bit variable specifying
the actual length of the data sent) being referenced when the variable hdrbytes is interrogating
further on in the code. Changing this variable to apr_size_t fixes the problem.
This problem should occur on any 64-bit Linux system. A simple HTML which includes <SCRIPT>
directives that cause javascript files to be downloaded will do the trick. 
--- /tmp/sendrecv.c     Mon Feb  4 18:28:43 2002
+++ srclib/apr/network_io/unix/sendrecv.c       Mon Feb  4 18:27:26 2002
@@ -291,11 +291,11 @@

     /* Ignore flags for now. */
     flags = 0;

     if (hdtr->numheaders > 0) {
-        apr_int32_t hdrbytes;
+        apr_size_t hdrbytes;

         /* cork before writing headers */
         rv = apr_setsocketopt(sock, APR_TCP_NOPUSH, 1);
         if (rv != APR_SUCCESS) {
             return rv;
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]

View raw message