[m-dev.] Possible NULL pointer dereference in Mercury ODBC library

Julien Fischer jfischer at opturion.com
Wed Sep 27 15:45:32 AEST 2017


Hi Keri,

On Tue, 26 Sep 2017, Keri Harris wrote:

> When compiling the Mercury ODBC library (extras/odbc) I get the following 
> warning:
>
> odbc.m: In function 'odbc_do_cleanup_statement':
> odbc.m:1695:14: warning: the comparison will always evaluate as 'true' for 
> the address of 'stat' will never be NULL [-Waddress]
>     if (stat != NULL) {
>              ^
> This looks like it's due to a typo (stat vs statement) and could possibly 
> lead to a NULL pointer dereference. The attached patch addresses this.

It looks like we replaced stat with statement in the C code back in
commit 749c6da and missed a spot.

I'll apply the patch -- thanks for pointing that out!

Cheers,
Julien.


More information about the developers mailing list