Commit 55a41c49 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #930

fix buffer overwrite error. Bug has been around, but just recently exposed
by checkin 4590

git-svn-id: file:///svn/mysql/tokudb-engine/src@4616 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9b2d2bea
...@@ -368,7 +368,6 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE * table) { ...@@ -368,7 +368,6 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE * table) {
if (!(share = (TOKUDB_SHARE *) hash_search(&tokudb_open_tables, (uchar *) table_name, length))) { if (!(share = (TOKUDB_SHARE *) hash_search(&tokudb_open_tables, (uchar *) table_name, length))) {
ulong *rec_per_key; ulong *rec_per_key;
char *tmp_name; char *tmp_name;
u_int32_t *key_type;
uint num_keys = table->s->keys; uint num_keys = table->s->keys;
if (!(share = (TOKUDB_SHARE *) if (!(share = (TOKUDB_SHARE *)
...@@ -376,7 +375,6 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE * table) { ...@@ -376,7 +375,6 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE * table) {
&share, sizeof(*share), &share, sizeof(*share),
&tmp_name, length + 1, &tmp_name, length + 1,
&rec_per_key, num_keys * sizeof(ha_rows), &rec_per_key, num_keys * sizeof(ha_rows),
&key_type, (num_keys + 1) * sizeof(u_int32_t),
NullS))) { NullS))) {
pthread_mutex_unlock(&tokudb_mutex); pthread_mutex_unlock(&tokudb_mutex);
return NULL; return NULL;
...@@ -387,7 +385,6 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE * table) { ...@@ -387,7 +385,6 @@ static TOKUDB_SHARE *get_share(const char *table_name, TABLE * table) {
strmov(share->table_name, table_name); strmov(share->table_name, table_name);
share->rec_per_key = rec_per_key; share->rec_per_key = rec_per_key;
share->key_type = key_type;
bzero((void *) share->key_file, sizeof(share->key_file)); bzero((void *) share->key_file, sizeof(share->key_file));
if (my_hash_insert(&tokudb_open_tables, (uchar *) share)) if (my_hash_insert(&tokudb_open_tables, (uchar *) share))
......
...@@ -21,10 +21,11 @@ typedef struct st_tokudb_share { ...@@ -21,10 +21,11 @@ typedef struct st_tokudb_share {
DB *file; DB *file;
// //
// array of all DB's that make up table, includes DB that // array of all DB's that make up table, includes DB that
// is indexed on the primary key // is indexed on the primary key, add 1 in case primary
// key is hidden
// //
DB *key_file[MAX_KEY]; DB *key_file[MAX_KEY +1];
u_int32_t *key_type; u_int32_t key_type[MAX_KEY +1];
uint status, version; uint status, version;
uint ref_length; uint ref_length;
bool fixed_length_primary_key, fixed_length_row; bool fixed_length_primary_key, fixed_length_row;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment