'ajp_msg_append_cvt_string(): BufferOverflowException on apache 2.4

In below code from apache server ajp_msg.c, any idea where the msg->max_size is coming from ?

I am trying to fix error message below :

ajp_msg_append_cvt_string(): BufferOverflowException 4 8186

**
*  Add a String in AJP message, and transform the String in ASCII
*  if convert is set and we're on an EBCDIC machine
*
* @param msg       AJP Message to get value from
* @param value     Pointer to String
* @param convert   When set told to convert String to ASCII
* @return          APR_SUCCESS or error
*/
apr_status_t ajp_msg_append_string_ex(ajp_msg_t *msg, const char *value,
                                      int convert)
{
    apr_size_t len;

    if (value == NULL) {
        return(ajp_msg_append_uint16(msg, 0xFFFF));
    }

    len = strlen(value);
    if ((msg->len + len + 3) > msg->max_size) {
        return ajp_log_overflow(msg, "ajp_msg_append_cvt_string");
    }

    /* ignore error - we checked once */
    ajp_msg_append_uint16(msg, (apr_uint16_t)len);

    /* We checked for space !!  */
    memcpy(msg->buf + msg->len, value, len + 1); /* including \0 */

    if (convert) {
        /* convert from EBCDIC if needed */
        ap_xlate_proto_to_ascii((char *)msg->buf + msg->len, len + 1);
    }

    msg->len += len + 1;

    return APR_SUCCESS;
}


Solution 1:[1]

Look at the max_packet_size attribute. The default value in AJP is 8192.

This attribute sets the maximal AJP packet size in Bytes. The maximum value you can set is 65536. If you change it from the default, you must also change the packetSize attribute of your AJP connector on the Tomcat side! The attribute packetSize is available in Tomcat 6.0.2 onwards. The above settings needs to be done in the tomcat-connector and tomcat itself (a corresponding setting must be made in the AJP element in Tomcat's conf/server.xml file).

See here for more details.

Solution 2:[2]

In my case the error was this

AH00548: NameVirtualHost has no effect and will be removed in the next release /home/jadmin_q/apache2/conf/extra/httpd-vhosts.conf:1

As mentioned i opened the file httpd-vhosts.conf and line number 1 and commented the line NameVirtualHost and next time the error did not came

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Majid Hajibaba
Solution 2 Sandeep Negi