Ethereal-users: Re: [Ethereal-users] core dump when reading snoop of ldap protocol

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 30 Jul 2003 01:09:01 -0700
On Wed, Jul 30, 2003 at 12:27:26AM -0400, Matt Selsky wrote:
> > s should not be set to string.
> > 
> > The variable *pointed to by s* should be set to string.
> > 
> > Given that s is null, it does not point to any variable, and therefore 
> > there is nothing to set to string.
> 
> I don't believe s is null.  The variable pointed to by s is null.

In your earlier message, you said

> static int read_string_value(ASN1_SCK *a, proto_tree *tree, int hf_id,
>         proto_item **new_item, char **s, int start, guint length)      
> 
> s = 0 and length = 0                                             
> 
> Since length = 0,
> 
>     string = "(null)";
> 
> But at the end of the function:                     
> 
>   if (s && length)                                                      
>     *s = string;              
>   else if (length)                                                  
>     g_free(string);                                
> 
> s should be set to string, but it's not since s is null.

and I'd interpreted "s is null" to mean that s is null.  I guess that
was an incorrect interpretation.  :-)

Presumably you didn't mean "s = 0" in "s = 0 and length = 0", and meant
"s should be set to string, but it's not since length is 0" rather
than "...since s is null".

Unfortunately, at least some places appear to expect a null pointer to
be returned for a zero-length string (the stuff that handles SASL
negotiation), so changing "read_string()" is not necessarily the right
answer; so, instead, I'll check in changes to check for a null pointer
and display "(null)" if the pointer is null.