[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_close crashing application
- From: Kevin Martin <kev82@...>
- Date: Sun, 6 Apr 2014 18:10:30 +0100
On 6 Apr 2014, at 17:12, Milind Gupta <milind.gupta@gmail.com> wrote:
> 1. Comment out lines 106,107,108 the ones with the string concatenation
Looks to me like a basic buffer overrun, clobbering something that is required by lua_close - hence the crash on lua_close.
Adding a new line 109:
printf("\n\n ***strlen of fullerr: %d ***\n\n", strlen(fullerr));
You should see that you overrun the length of buffer by 28 bytes (strlen does't include terminating zero).
Replace your strcpy/strcat with strncpy/strncat, or use a luaL_Buffer to construct the error, or use your platform's equivalent of open_memstream along with fprintf.
Thanks,
Kevin