ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

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

Date: Mon, 2 Oct 2006 19:06:48 +0200
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