httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/ssl ssl_engine_io.c
Date Thu, 17 Jan 2002 15:51:41 GMT
wrowe       02/01/17 07:51:41

  Modified:    modules/ssl ssl_engine_io.c
  Log:
    Clean up several typesaftey (signedness and size) emits.
  
  Revision  Changes    Path
  1.52      +11 -7     httpd-2.0/modules/ssl/ssl_engine_io.c
  
  Index: ssl_engine_io.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_engine_io.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- ssl_engine_io.c	17 Jan 2002 05:04:54 -0000	1.51
  +++ ssl_engine_io.c	17 Jan 2002 15:51:41 -0000	1.52
  @@ -397,7 +397,9 @@
           }
   
           if (buf_len) {
  -            if ((len + buf_len) >= inl) {
  +            /* Protected against len > MAX_INT 
  +             */
  +            if ((len + (int)buf_len) >= inl || (int)buf_len < 0) {
                   /* we have enough to fill the buffer.
                    * append if we have already written to the buffer.
                    */
  @@ -405,7 +407,7 @@
                   char *value = (char *)buf+nibble;
   
                   int length = buf_len - nibble;
  -                memcpy((void*)in+len, buf, nibble);
  +                memcpy(in + len, buf, nibble);
   
                   char_buffer_write(&inbio->cbuf, value, length);
                   len += nibble;
  @@ -416,7 +418,7 @@
                   /* not enough data,
                    * save what we have and try to read more.
                    */
  -                memcpy((void*)in+len, buf, buf_len);
  +                memcpy(in + len, buf, buf_len);
                   len += buf_len;
               }
           }
  @@ -623,8 +625,9 @@
                                         char *buf,
                                         apr_size_t *len)
   {
  -    int wanted = *len;
  -    int bytes = 0, rc;
  +    apr_size_t wanted = *len;
  +    apr_size_t bytes = 0;
  +    int rc;
   
       *len = 0;
   
  @@ -635,7 +638,7 @@
           }
       }
   
  -    rc = ssl_io_hook_read(ctx->frec->pssl, buf+bytes, wanted-bytes);
  +    rc = ssl_io_hook_read(ctx->frec->pssl, buf + bytes, wanted - bytes);
   
       if (rc > 0) {
           *len += rc;
  @@ -747,8 +750,9 @@
       }
   
       if (bytes > 0) {
  +        /* Protected from truncation, bytes < MAX_SIZE_T */
           if (bytes < len) {
  -            len = bytes;
  +            len = (apr_size_t)bytes;
           }
           ctx->inbio.getline = 0;
           status = ssl_io_input_read(ctx, ctx->buffer, &len);
  
  
  

Mime
View raw message