lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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