Wireshark-dev: Re: [Wireshark-dev] address_to_str_buf not checking available buffer length
From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Mon, 29 Jan 2007 12:49:00 -0800
Andrej Mikus wrote:

> In file to_str.c I notice function address_to_str_buf that takes buf_len
> as argument, but does not use it for IPv4 and IPv6 addresses:
> 
> void
> address_to_str_buf(const address *addr, gchar *buf, int buf_len)
> {
>   switch(addr->type){
>   case AT_IPv4:
>     ip_to_str_buf(addr->data, buf);
>     break;
>   case AT_IPv6:
>     inet_ntop(AF_INET6, addr->data, buf, INET6_ADDRSTRLEN);
>     break;
> 
> Out of curiosity, is there another mechanism in place to ensure that the
> buffer is always big enough? I notice that some dissectors call this
> function directly.

Unfortunately, there wasn't a mechanism to ensure that the buffer was
big enough.  I've checked in a change (r20607) that should fix this.  It
looks like this could potentially affect the ISUP statistics, so I'll
add it to the advisory list for 0.99.5.