Wireshark-dev: Re: [Wireshark-dev] Small performance improvements to packet-http.c
From: Stephen Fisher <[email protected]>
Date: Wed, 7 Nov 2007 17:23:39 -0700
On Thu, Nov 08, 2007 at 12:54:14AM +0100, Didier wrote:
> Hi,
> 
> On Wed, 7 Nov 2007 11:58:24 +0200, Kaul wrote
> > Attached please find a version which reverts back the erroneous printf() changes. Sorry.
> 
> There's a bug
> conv_data->request_method = ep_strndup("POST", 4);
> should be
> se_strndup

Right, because conv_data is allocated with as seasonal (se_).  BTW, with
a standard NULL terminated string, [se|ep]_strdup() is safe to use
because it checks the string length and allocates that much space at the
pointer it returns.

> Or better:
> stat_info->request_method = "POST"
> conv_data->request_method ="POST"
> 
> And you can precompute 
> (headers[i].namelen - 1)

But the memory still needs to be allocated...


Steve