On Fri, Sep 20, 2002 at 10:59:47AM -0600, Greg Morris wrote:
> Please see attached diffs for most NDS decodes. I am still working on
> the rest but I wanted to get my work to date submitted for review. I
> know there is more then likely a lot of cleanup that can be done but I
> haven't taken the time yet. Please let me know what you think,
There's a fairly nasty bug in the changes to "packet-ncp2222.inc".
The routine "get_string()" assumes that the "dest_buf" argument points
to a buffer large enough to hold the string it's going to extract.
However, it's typically just a pointer to a null string constant ("").
That means that:
on platforms where string constants are in read-only memory,
Ethereal will crash trying to store into read-only memory (it
*DID* crash with at least one capture I have!);
on platforms where string constants aren't in read-only memory,
Ethereal will write past the end of the string constant,
overwriting some other random bit of memory.
You will have to make "get_string()" allocate a buffer, using
"g_malloc()", to hold the string, and return a pointer to that buffer.
You will also have to make sure that buffer gets freed when it's no
longer needed.
Unfortunately, as "global_object_name" is set to point to data extracted
with "get_string()", and as the code to use the result of "get_string()"
is sometimes not near the call to "get_string()", doing so is hard in
some cases.