]> granicus.if.org Git - php/commitdiff
fix segfault introduced by Pierre in a recent commit
authorAndrey Hristov <andrey@php.net>
Thu, 3 Dec 2009 09:43:26 +0000 (09:43 +0000)
committerAndrey Hristov <andrey@php.net>
Thu, 3 Dec 2009 09:43:26 +0000 (09:43 +0000)
old code was doing something like
conn + sizeof(MYSQLND) * MYSQLND + plugin * sizeof(void) * sizeof(MYSQLND)
because `conn` is not casted to void*. `conn` has to be casted to void * and
then the whole experession will be void * and the calculations will work.

ext/mysqlnd/mysqlnd.c

index 3d4b02677af70ae1829bd5948a3e2d0ee4948139..365068d60c42d0d3ab85c53f12447d8abe4998e0 100644 (file)
@@ -2393,7 +2393,7 @@ PHPAPI void ** _mysqlnd_plugin_get_plugin_connection_data(const MYSQLND * conn,
        if (!conn || plugin_id >= mysqlnd_plugin_count()) {
                return NULL;
        }
-       DBG_RETURN((void *)(conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)));
+       DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *));
 }
 /* }}} */