You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2004/07/28 20:13:11 UTC

cvs commit: jakarta-tomcat-connectors/ajp/ajplib/test ajp_msg.c ajp.h

mturk       2004/07/28 11:13:11

  Modified:    ajp/ajplib/test ajp_msg.c ajp.h
  Log:
  casting cleanup for msg->buf
  
  Revision  Changes    Path
  1.8       +14 -8     jakarta-tomcat-connectors/ajp/ajplib/test/ajp_msg.c
  
  Index: ajp_msg.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp_msg.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ajp_msg.c	28 Jul 2004 17:43:17 -0000	1.7
  +++ ajp_msg.c	28 Jul 2004 18:13:11 -0000	1.8
  @@ -262,7 +262,7 @@
       ajp_msg_append_uint16(msg, (apr_uint16_t)len);
   
       /* We checked for space !!  */
  -    strncpy((char *)msg->buf + msg->len, value, len + 1); /* including \0 */
  +    memcpy(msg->buf + msg->len, value, len + 1); /* including \0 */
   
       if (convert)   /* convert from EBCDIC if needed */
           ajp_xlate_to_ascii((char *)msg->buf + msg->len, len + 1);
  @@ -322,7 +322,7 @@
       }
   
       /* We checked for space !!  */
  -    memcpy((char *)msg->buf + msg->len, value, valuelen);
  +    memcpy(msg->buf + msg->len, value, valuelen);
       msg->len += valuelen;
   
       return APR_SUCCESS;
  @@ -474,13 +474,14 @@
    * @return          APR_SUCCESS or error
    */
   apr_status_t ajp_msg_get_bytes(ajp_msg_t *msg, apr_byte_t **rvalue,
  -                               apr_size_t *rvalueLen)
  +                               apr_size_t *rvalue_len)
   {
       apr_uint16_t size;
       apr_size_t   start;
       apr_status_t status;
   
       status = ajp_msg_get_uint16(msg, &size);
  +    /* save the current position */
       start = msg->pos;
   
       if ((status != APR_SUCCESS) || (size + start > AJP_MSG_BUFFER_SZ)) {
  @@ -489,11 +490,10 @@
                         msg->pos, msg->len);
           return AJP_EOVERFLOW;
       }
  -
       msg->pos += (apr_size_t)size;   /* only bytes, no trailer */
   
  -    *rvalue    = (apr_byte_t *)(msg->buf + start);
  -    *rvalueLen = size;
  +    *rvalue     = msg->buf + start;
  +    *rvalue_len = size;
   
       return APR_SUCCESS;
   }
  @@ -510,7 +510,7 @@
   {
       ajp_msg_t *msg = (ajp_msg_t *)apr_pcalloc(pool, sizeof(ajp_msg_t));
   
  -    if (! msg) {
  +    if (!msg) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, NULL,
                         "ajp_msg_create(): can't allocate AJP message memory");
           return APR_ENOPOOL;
  @@ -519,7 +519,13 @@
       msg->server_side = 0;
   
       msg->buf = (apr_byte_t *)apr_palloc(pool, AJP_MSG_BUFFER_SZ);
  -
  +    
  +    /* XXX: This should never happen
  +     * In case if the OS cannont allocate 8K of data
  +     * we are in serious trouble
  +     * No need to check the alloc return value, cause the
  +     * core dump is probably the best solution anyhow.
  +     */
       if (msg->buf == NULL) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, NULL,
                         "ajp_msg_create(): can't allocate AJP message memory");
  
  
  
  1.12      +1 -1      jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h
  
  Index: ajp.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/ajp/ajplib/test/ajp.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ajp.h	28 Jul 2004 17:43:17 -0000	1.11
  +++ ajp.h	28 Jul 2004 18:13:11 -0000	1.12
  @@ -261,7 +261,7 @@
    * @return          APR_SUCCESS or error
    */
   apr_status_t ajp_msg_get_bytes(ajp_msg_t *msg, apr_byte_t **rvalue,
  -                               apr_size_t *rvalueLen);
  +                               apr_size_t *rvalue_len);
   
   /**
    * Create an AJP Message from pool
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org