There's a small bug in the fastcgi header parsing code, the chars need
to be treated as unsigned in order for all the shifting to work
properly...

Log follows, patch attached.

-garrett

Fix the extraction of shorts from the header parsing code.

* modules/proxy/mod_proxy_fcgi.c
  (dispatch): Cast the parts of the short values to unsigned before shifting
   and oring them together.
Index: modules/proxy/mod_proxy_fcgi.c
===================================================================
--- modules/proxy/mod_proxy_fcgi.c	(revision 360174)
+++ modules/proxy/mod_proxy_fcgi.c	(working copy)
@@ -482,8 +482,8 @@
 
             type = readbuf[1];
 
-            rid |= readbuf[2] << 8;
-            rid |= readbuf[3] << 0;
+            rid |= ((unsigned char) readbuf[2]) << 8;
+            rid |= ((unsigned char) readbuf[3]) << 0;
 
             if (rid != request_id) {
                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
@@ -493,8 +493,8 @@
                 break;
             }
 
-            clen |= readbuf[4] << 8;
-            clen |= readbuf[5] << 0;
+            clen |= ((unsigned char) readbuf[4]) << 8;
+            clen |= ((unsigned char) readbuf[5]) << 0;
 
             plen = readbuf[6];
 

Reply via email to