diff options
author | marko@hundin.mysql.fi <> | 2004-04-01 16:51:34 +0300 |
---|---|---|
committer | marko@hundin.mysql.fi <> | 2004-04-01 16:51:34 +0300 |
commit | e00bf40360ce47ce718afe85cccfb28ac4c4e8ac (patch) | |
tree | fab5076a83cb8b112b16f76355f3a96a708c48ba /innobase/dict/dict0mem.c | |
parent | ebc7b6ba87da09082b61b57d77c17af867ef804f (diff) | |
download | mariadb-git-e00bf40360ce47ce718afe85cccfb28ac4c4e8ac.tar.gz |
InnoDB cleanup: fixing buffer overflows and quoting of quotes
Diffstat (limited to 'innobase/dict/dict0mem.c')
-rw-r--r-- | innobase/dict/dict0mem.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/innobase/dict/dict0mem.c b/innobase/dict/dict0mem.c index f8c54022c9e..c4b393d292b 100644 --- a/innobase/dict/dict0mem.c +++ b/innobase/dict/dict0mem.c @@ -49,9 +49,7 @@ dict_mem_table_create( table->heap = heap; - str = mem_heap_alloc(heap, 1 + ut_strlen(name)); - - ut_strcpy(str, name); + str = mem_heap_strdup(heap, name); table->type = DICT_TABLE_ORDINARY; table->name = str; @@ -146,7 +144,6 @@ dict_mem_table_add_col( ulint len, /* in: length */ ulint prec) /* in: precision */ { - char* str; dict_col_t* col; dtype_t* type; @@ -154,15 +151,11 @@ dict_mem_table_add_col( ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); table->n_def++; - - col = dict_table_get_nth_col(table, table->n_def - 1); - - str = mem_heap_alloc(table->heap, 1 + ut_strlen(name)); - ut_strcpy(str, name); + col = dict_table_get_nth_col(table, table->n_def - 1); col->ind = table->n_def - 1; - col->name = str; + col->name = mem_heap_strdup(table->heap, name); col->table = table; col->ord_part = 0; @@ -188,7 +181,6 @@ dict_mem_index_create( ulint type, /* in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */ ulint n_fields) /* in: number of fields */ { - char* str; dict_index_t* index; mem_heap_t* heap; @@ -199,13 +191,9 @@ dict_mem_index_create( index->heap = heap; - str = mem_heap_alloc(heap, 1 + ut_strlen(index_name)); - - ut_strcpy(str, index_name); - index->type = type; index->space = space; - index->name = str; + index->name = mem_heap_strdup(heap, index_name); index->table_name = table_name; index->table = NULL; index->n_def = 0; |