luadbi icon indicating copy to clipboard operation
luadbi copied to clipboard

Invalid pointer being assigned to struct

Open basak opened this issue 5 years ago • 0 comments

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.

basak avatar Jul 16 '19 10:07 basak