mwild1 / luadbi

Multi-backend SQL database library for Lua
MIT License
38 stars 14 forks source link

Invalid pointer being assigned to struct #56

Closed basak closed 8 months ago

basak commented 4 years ago

In https://github.com/mwild1/luadbi/blob/73a234c4689e4f87b7520276b6159cc7f6cfd6e0/dbd/mysql/statement.c#L221 you are casting the integer 1 to a pointer as is_null is defined as a pointer. This makes no sense - the pointer (0x0001 if you like) is invalid.

The documentation at https://dev.mysql.com/doc/refman/8.0/en/c-api-prepared-statement-data-structures.html says that you do not have to set is_null at all where it is not used, and to (bool *)0 if you must (ie. NULL, which is an acceptable pointer value). Setting a pointer directly to the constant 1 make no sense however.