https://issues.apache.org/bugzilla/show_bug.cgi?id=56452

--- Comment #4 from Christopher Schultz <ch...@christopherschultz.net> ---
(In reply to Konstantin Kolinko from comment #3)
> (In reply to Christopher Schultz from comment #2)
> > Created attachment 31557 [details]
> > Proposed patch (against mod_jk/trunk)
> > 
> > I have raised the size of buf from 64 to 100 characters. The message looks
> > like it will need 96 bytes for a complete IPv6 message (e.g.
> > 2001:0db8:0000:0000:0000:ff00:0042:8329:65556 ->
> > 2001:0db8:0000:0000:0000:ff00:0042:8329:65535 + \0), so I just rounded up to
> > 100 bytes.
> > 
> > I've also added proper length-tracking to the buffer and more protection
> > against overruns.
> 
> The following discussion says that IPv6 address needs maximum 45 characters,
> not 39. So you would need 12 bytes more than 96 = 108.

Bah, I forgot about tunnelled-IPv4. However:

"0000:0000:0000:0000:0000:0000:192.168.0.1:65535 ->
0000:0000:0000:0000:0000:0000:192.168.0.1:65535"

That's only 97 bytes plus a NULL-terminator. Where did you get the 39 from?

> http://stackoverflow.com/questions/166132/maximum-length-of-the-textual-
> representation-of-an-ipv6-address
> 
> Also see tmp buffer size here:
> http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/inet_ntop.
> c?revision=573491&view=markup#l149

I did see that code in APR while researching. I suppose I could use that, but I
figured that "buf" might be used for other things so I didn't consider it. I
think it turns out that "buf" is really just for this purpose, so we could do
something like this if you'd prefer:

  char buf[sizeof "0000:0000:0000:0000:0000:0000:192.168.0.1:65535 ->
0000:0000:0000:0000:0000:0000:192.168.0.1:65535" + 1];

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to