You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/03/14 22:21:30 UTC

svn commit: r157467 - httpd/apreq/branches/multi-env-unstable/library/module_cgi.c

Author: joes
Date: Mon Mar 14 13:21:28 2005
New Revision: 157467

URL: http://svn.apache.org/viewcvs?view=rev&rev=157467
Log:
Protect against potential segfaults in the cgi case, 
when there's no body to parse.

This patch just copies r157446 from the apache2 case.
It doesn't appear to actually be necessary at this point,
but keeping the cgi & apache2 code in sync seems like a
good idea right now.


Modified:
    httpd/apreq/branches/multi-env-unstable/library/module_cgi.c

Modified: httpd/apreq/branches/multi-env-unstable/library/module_cgi.c
URL: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/library/module_cgi.c?view=diff&r1=157466&r2=157467
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/library/module_cgi.c (original)
+++ httpd/apreq/branches/multi-env-unstable/library/module_cgi.c Mon Mar 14 13:21:28 2005
@@ -476,7 +476,7 @@
             /* riff on Duff's device */
             cgi_read(env, APREQ_DEFAULT_READ_BLOCK_SIZE);
 
-    default:
+    case APR_SUCCESS:
 
             val = apr_table_get(handle->body, name);
             if (val != NULL)
@@ -484,6 +484,15 @@
 
         } while (handle->body_status == APR_INCOMPLETE);
 
+        break;
+
+    default:
+
+        if (handle->body != NULL) {
+            val = apr_table_get(handle->body, name);
+            if (val != NULL)
+                return apreq_value_to_param(val);
+        }
     }
 
     return NULL;