From 78deb348f0d8579cccbac2afb1fd5ec982d2fd07 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Jun 2006 12:29:04 +0200 Subject: [PATCH] BUG#20498: Wrong usage of hash_first() in get_open_table(). The get_open_table() function was using the wrong key for hash lookups. This could potentially lead to unpredictable behaviour. sql/ha_ndbcluster.cc: BUG#20498: Wrong usage of hash_first() in get_open_table(). --- sql/ha_ndbcluster.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 2d623702670..2c9798369ed 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -317,7 +317,7 @@ byte *thd_ndb_share_get_key(THD_NDB_SHARE *thd_ndb_share, uint *length, my_bool not_used __attribute__((unused))) { *length= sizeof(thd_ndb_share->key); - return (byte*) thd_ndb_share->key; + return (byte*) &thd_ndb_share->key; } Thd_ndb::Thd_ndb() @@ -371,9 +371,9 @@ Thd_ndb::get_open_table(THD *thd, const void *key) DBUG_ENTER("Thd_ndb::get_open_table"); HASH_SEARCH_STATE state; THD_NDB_SHARE *thd_ndb_share= - (THD_NDB_SHARE*)hash_first(&open_tables, (byte *)key, sizeof(key), &state); + (THD_NDB_SHARE*)hash_first(&open_tables, (byte *)&key, sizeof(key), &state); while (thd_ndb_share && thd_ndb_share->key != key) - thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (byte *)key, sizeof(key), &state); + thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (byte *)&key, sizeof(key), &state); if (thd_ndb_share == 0) { thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root,