You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2001/07/26 00:02:55 UTC

cvs commit: httpd-2.0/modules/generators mod_cgi.c

wrowe       01/07/25 15:02:55

  Modified:    modules/generators mod_cgi.c
  Log:
    Safe casts - we are assured that len_read is positive, but it must be
    stored as an int to initially check the ap_get_client_block() result.
  
  Revision  Changes    Path
  1.93      +4 -3      httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- mod_cgi.c	2001/02/28 15:24:05	1.92
  +++ mod_cgi.c	2001/07/25 22:02:54	1.93
  @@ -682,7 +682,7 @@
        * Note that we already ignore SIGPIPE in the core server.
        */
       if (ap_should_client_block(r)) {
  -	int dbsize, len_read;
  +	int len_read, dbsize;
           apr_size_t bytes_written, bytes_to_write;
           apr_status_t rv;
   
  @@ -712,8 +712,9 @@
                   rv = apr_file_write(script_out, argsbuffer + bytes_written, 
                                  &bytes_to_write);
                   bytes_written += bytes_to_write;
  -            } while (rv == APR_SUCCESS && bytes_written < len_read);
  -	    if (rv != APR_SUCCESS || bytes_written < len_read) {
  +            } while (rv == APR_SUCCESS 
  +                  && bytes_written < (apr_size_t)len_read);
  +	    if (rv != APR_SUCCESS || bytes_written < (apr_size_t)len_read) {
   		/* silly script stopped reading, soak up remaining message */
   		while (ap_get_client_block(r, argsbuffer, HUGE_STRING_LEN) > 0) {
   		    /* dump it */