]> granicus.if.org Git - php/commitdiff
@- Fix a problem when dealing with large POST blocks in CGI mode
authorZeev Suraski <zeev@php.net>
Sat, 1 Apr 2000 01:11:39 +0000 (01:11 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 1 Apr 2000 01:11:39 +0000 (01:11 +0000)
main/SAPI.c
main/SAPI.h

index aa673429b86ecdd660877f5b334e7ec169b5830a..ba3f1af2517364934724741275fadd0dbefbbda6 100644 (file)
@@ -160,27 +160,27 @@ static void sapi_read_post_data(SLS_D)
 
 SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
 {
-       int read_bytes, total_read_bytes=0;
+       int read_bytes;
        int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
 
        SG(request_info).post_data = emalloc(allocated_bytes);
 
        for (;;) {
-               read_bytes = sapi_module.read_post(SG(request_info).post_data+total_read_bytes, SAPI_POST_BLOCK_SIZE SLS_CC);
+               read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE SLS_CC);
                if (read_bytes<=0) {
                        break;
                }
-               total_read_bytes += read_bytes;
+               SG(read_post_bytes) += read_bytes;
                if (read_bytes < SAPI_POST_BLOCK_SIZE) {
                        break;
                }
-               if (total_read_bytes+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
-                       allocated_bytes = total_read_bytes+SAPI_POST_BLOCK_SIZE+1;
+               if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
+                       allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1;
                        SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes);
                }
        }
-       SG(request_info).post_data[total_read_bytes] = 0;  /* terminating NULL */
-       SG(request_info).post_data_length = total_read_bytes;
+       SG(request_info).post_data[SG(read_post_bytes)] = 0;  /* terminating NULL */
+       SG(request_info).post_data_length = SG(read_post_bytes);
 }
 
 
index d2352ed5254453791f3d60b06fda54f2e830b70a..47fbf20dda4ba7da1fe98e0d3e9519e1af740bcf 100644 (file)
@@ -95,7 +95,7 @@ typedef struct {
        void *server_context;
        sapi_request_info request_info;
        sapi_headers_struct sapi_headers;
-       uint read_post_bytes;
+       int read_post_bytes;
        unsigned char headers_sent;
        struct stat global_stat;
        char *default_mimetype;