httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy ajp_header.c ajp_link.c ajp_msg.c proxy_ajp.c
Date Sat, 11 Sep 2004 09:57:12 GMT
jorton      2004/09/11 02:57:12

  Modified:    modules/proxy ajp_header.c ajp_link.c ajp_msg.c proxy_ajp.c
  Log:
  Fix format string warnings in proxy_ajp on 64-bit platforms:
  
  * modules/proxy/ajp_header.c (ajp_send_data_msg): Use
  APR_SIZE_T_FMT.
  
  * modules/proxy/ajp_link.c (ajp_ilink_receive): Don't pass
  \n to ap_log_error; do use APR_SIZE_T_FMT.
  
  * modules/proxy/ajp_msg.c (ajp_msg_dump, ajp_msg_check_header,
  ajp_msg_copy): Use APR_SIZE_T_FMT.
  (ajp_log_overflow): New function.
  (ajp_msg_{append,peek,get}_*): Use it.
  
  * modules/proxy/proxy_ajp.c (ap_proxy_ajp_request): Use
  APR_SIZE_T_FMT.
  
  Revision  Changes    Path
  1.5       +1 -1      httpd-2.0/modules/proxy/ajp_header.c
  
  Index: ajp_header.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/ajp_header.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -d -w -u -r1.4 -r1.5
  --- ajp_header.c	25 Aug 2004 09:56:43 -0000	1.4
  +++ ajp_header.c	11 Sep 2004 09:57:12 -0000	1.5
  @@ -712,7 +712,7 @@
       msg->len += len + 2; /* + 1 XXXX where is '\0' */
   
       ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  -               "ajp_send_data_msg: sending %d", len);
  +               "ajp_send_data_msg: sending %" APR_SIZE_T_FMT, len);
   
       rc = ajp_ilink_send(sock, msg);
       if (rc != APR_SUCCESS) {
  
  
  
  1.3       +7 -5      httpd-2.0/modules/proxy/ajp_link.c
  
  Index: ajp_link.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/ajp_link.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -d -w -u -r1.2 -r1.3
  --- ajp_link.c	9 Sep 2004 19:55:24 -0000	1.2
  +++ ajp_link.c	11 Sep 2004 09:57:12 -0000	1.3
  @@ -102,7 +102,7 @@
       
       if (status != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_ERR, status, NULL,
  -                "ajp_ilink_receive() can't receive header\n");
  +                     "ajp_ilink_receive() can't receive header");
           return AJP_ENO_HEADER;
       }
       
  @@ -110,7 +110,7 @@
   
       if (status != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_ilink_receive() received bad header\n");
  +                     "ajp_ilink_receive() received bad header");
           return AJP_EBAD_HEADER;
       }
   
  @@ -118,13 +118,15 @@
   
       if (status != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_ERR, status, NULL,
  -                      "ajp_ilink_receive() error while receiving message body of length
%d\n",
  +                     "ajp_ilink_receive() error while receiving message body "
  +                     "of length %" APR_SIZE_T_FMT,
                         hlen);
           return AJP_EBAD_MESSAGE;
       }
   
       ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
  -                  "ajp_ilink_receive() received packet len=%d type=%d\n",
  +                 "ajp_ilink_receive() received packet len=%" APR_SIZE_T_FMT
  +                 "type=%d\n",
                     blen, (int)msg->buf[hlen]);
   
       return APR_SUCCESS;
  
  
  
  1.2       +32 -62    httpd-2.0/modules/proxy/ajp_msg.c
  
  Index: ajp_msg.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/ajp_msg.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -d -w -u -r1.1 -r1.2
  --- ajp_msg.c	18 Aug 2004 16:09:27 -0000	1.1
  +++ ajp_msg.c	11 Sep 2004 09:57:12 -0000	1.2
  @@ -38,7 +38,8 @@
           len = 1024;
   
       ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
  -                  "ajp_msg_dump(): %s pos=%d len=%d max=%d",
  +                 "ajp_msg_dump(): %s pos=%" APR_SIZE_T_FMT 
  +                 " len=%" APR_SIZE_T_FMT " max=%d",
                     err, msg->pos, msg->len, AJP_MSG_BUFFER_SZ);
   
       for (i = 0; i < len; i += 16) {
  @@ -68,7 +69,7 @@
           *current++ = '\0';
   
           ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
  -                      "ajp_msg_dump(): %.4x    %s",
  +                      "ajp_msg_dump(): %.4lx    %s",
                         i, line);
       }
       
  @@ -103,7 +104,8 @@
   
       if (msglen > AJP_MSG_BUFFER_SZ) {
           ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_check_msg_header() incoming message is too big %d, max is %d",
  +                     "ajp_check_msg_header() incoming message is "
  +                     "too big %" APR_SIZE_T_FMT ", max is %d",
                         msglen, AJP_MSG_BUFFER_SZ);
           return AJP_ETOBIG;
       }
  @@ -154,6 +156,15 @@
       return APR_SUCCESS;
   }
   
  +static APR_INLINE int ajp_log_overflow(ajp_msg_t *msg, const char *context)
  +{
  +    ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  +                 "%s(): BufferOverflowException %" APR_SIZE_T_FMT 
  +                 " %" APR_SIZE_T_FMT,
  +                 context, msg->pos, msg->len);
  +    return AJP_EOVERFLOW;
  +}
  +
   /**
    * Add an unsigned 32bits value to AJP Message
    *
  @@ -166,10 +177,7 @@
       apr_size_t len = msg->len;
   
       if ((len + 4) > AJP_MSG_BUFFER_SZ) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_append_uint32(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_append_uint32");
       }
   
       msg->buf[len]     = (apr_byte_t)((value >> 24) & 0xFF);
  @@ -194,10 +202,7 @@
       apr_size_t len = msg->len;
   
       if ((len + 2) > AJP_MSG_BUFFER_SZ) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_append_uint16(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_append_uint16");
       }
   
       msg->buf[len]     = (apr_byte_t)((value >> 8) & 0xFF);
  @@ -220,10 +225,7 @@
       apr_size_t len = msg->len;
   
       if ((len + 1) > AJP_MSG_BUFFER_SZ) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_append_uint8(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_append_uint8");
       }
   
       msg->buf[len] = value;
  @@ -252,10 +254,7 @@
   
       len = strlen(value);
       if ((msg->len + len + 2) > AJP_MSG_BUFFER_SZ) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -            "ajp_msg_append_cvt_string(): BufferOverflowException %d %d",
  -            msg->pos, msg->len);
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_append_cvt_string");
       }
   
       /* ignore error - we checked once */
  @@ -288,10 +287,7 @@
       }
   
       if ((msg->len + valuelen) > AJP_MSG_BUFFER_SZ) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_append_bytes(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_append_bytes");
       }
   
       /* We checked for space !!  */
  @@ -313,11 +309,7 @@
       apr_uint32_t value;
   
       if ((msg->pos + 3) > msg->len) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_get_long(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_get_uint32");
       }
   
       value  = ((msg->buf[(msg->pos++)] & 0xFF) << 24);
  @@ -342,11 +334,7 @@
       apr_uint16_t value;
       
       if ((msg->pos + 1) > msg->len) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_get_int(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_get_uint16");
       }
   
       value  = ((msg->buf[(msg->pos++)] & 0xFF) << 8);
  @@ -369,11 +357,7 @@
       apr_uint16_t value;
   
       if ((msg->pos + 1) > msg->len) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_peek_int(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_peek_uint16");
       }
       
       value = ((msg->buf[(msg->pos)] & 0xFF) << 8);
  @@ -394,11 +378,7 @@
   apr_status_t ajp_msg_peek_uint8(ajp_msg_t *msg, apr_byte_t *rvalue)
   {
       if (msg->pos > msg->len) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_peek_uint8(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_peek_uint8");
       }
       
       *rvalue = msg->buf[msg->pos];
  @@ -416,11 +396,7 @@
   {
   
       if (msg->pos > msg->len) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_get_uint8(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_get_uint8");
       }
       
       *rvalue = msg->buf[msg->pos++];
  @@ -445,11 +421,7 @@
       start = msg->pos;
   
       if ((status != APR_SUCCESS) || (size + start > AJP_MSG_BUFFER_SZ)) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_get_string(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_get_string");
       }
   
       msg->pos += (apr_size_t)size;
  @@ -480,10 +452,7 @@
       start = msg->pos;
   
       if ((status != APR_SUCCESS) || (size + start > AJP_MSG_BUFFER_SZ)) {
  -        ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -                      "ajp_msg_get_bytes(): BufferOverflowException %d %d",
  -                      msg->pos, msg->len);
  -        return AJP_EOVERFLOW;
  +        return ajp_log_overflow(msg, "ajp_msg_get_bytes");
       }
       msg->pos += (apr_size_t)size;   /* only bytes, no trailer */
   
  @@ -551,7 +520,8 @@
       
       if (smsg->len > AJP_MSG_BUFFER_SZ) {
           ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL,
  -            "ajp_msg_copy(): destination buffer too small %d, max size is %d",
  +                     "ajp_msg_copy(): destination buffer too "
  +                     "small %" APR_SIZE_T_FMT ", max size is %d",
               smsg->len, AJP_MSG_BUFFER_SZ);
           return  AJP_ETOSMALL;
       }
  
  
  
  1.20      +3 -2      httpd-2.0/modules/proxy/proxy_ajp.c
  
  Index: proxy_ajp.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ajp.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -d -w -u -r1.19 -r1.20
  --- proxy_ajp.c	10 Sep 2004 14:48:20 -0000	1.19
  +++ proxy_ajp.c	11 Sep 2004 09:57:12 -0000	1.20
  @@ -175,7 +175,8 @@
   
           /* Try to send something */
           ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  -                     "proxy: data to read (max %d at %d)", bufsiz, msg->pos);
  +                     "proxy: data to read (max %" APR_SIZE_T_FMT 
  +                     " at %" APR_SIZE_T_FMT ")", bufsiz, msg->pos);
   
           status = apr_brigade_flatten(input_brigade, buff, &bufsiz);
           if (status != APR_SUCCESS) {
  @@ -187,7 +188,7 @@
           apr_brigade_cleanup(input_brigade);
   
           ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
  -                     "proxy: got %d byte of data", bufsiz);
  +                     "proxy: got %" APR_SIZE_T_FMT " bytes of data", bufsiz);
           if (bufsiz > 0) {
               status = ajp_send_data_msg(conn->sock, r, msg, bufsiz);
               if (status != APR_SUCCESS) {
  
  
  

Mime
View raw message