Wireshark-dev: Re: [Wireshark-dev] call to cf_read(&cfile) corrupts stack

Date: Wed, 4 Oct 2006 19:48:01 +0100
Nope!
I was running it from a TextWindow... where the button callback data
was ep_allocated...
ep_allocated memory got reused after cf_read() and so it crashed...


On 10/2/06, LEGO <luis.ontanon@xxxxxxxxx> wrote:
Hi folks,

while writing an open_capture_file() function for lua I came up with
an odd situation.

When executing the following code more than once, during the cf_read
call the stack gets overwritten.

        if (cf_open(&cfile, fname, FALSE, &err) != CF_OK) {
                return FALSE;
        }
        cfile.rfcode = rfcode;

        switch (cf_read(&cfile)) {
                case CF_READ_OK:
                case CF_READ_ERROR:
                        break;
                default:
                        return FALSE;
        }

overwriting happens when calling wtap_read() from file.c:405

I tried to understand why this happens but nothing appears to me to be
the cause.

Is there something I should do before calling cf_open() to avoid this happening.

Thanks,
Luis


--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan



--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan