summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-07-20 16:05:55 +0500
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-07-20 16:05:55 +0500
commit1a2d2117ffcd9641ed472039f29c8996023e7b60 (patch)
treec5d4d76d4f8176a72b1d547dd1f7fc1c6417e13d /sql-common
parentc20595d8a0f2a18c7b6d7d85c6c2b42b5025df8d (diff)
downloadmariadb-git-1a2d2117ffcd9641ed472039f29c8996023e7b60.tar.gz
Bug #29494 Field packet with NULL fields crashes libmysqlclient.
unpack_fields() didn't expect NULL_LENGHT in the field's descriptions. In this case we get NULL in the resulting string so cannot use strdup_root to make a copy of it. strdup_root changed with strmake_root as it's NULL-safe sql-common/client.c: Bug #29494 Field packet with NULL fields crashes libmysqlclient strdup_root changed with strmake_root in unpack_fields()
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 431c1bdf418..bf9c7252283 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1176,12 +1176,12 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
/* fields count may be wrong */
DBUG_ASSERT ((field - result) < fields);
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
- field->catalog = strdup_root(alloc,(char*) row->data[0]);
- field->db = strdup_root(alloc,(char*) row->data[1]);
- field->table = strdup_root(alloc,(char*) row->data[2]);
- field->org_table= strdup_root(alloc,(char*) row->data[3]);
- field->name = strdup_root(alloc,(char*) row->data[4]);
- field->org_name = strdup_root(alloc,(char*) row->data[5]);
+ field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]);
+ field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]);
+ field->table= strmake_root(alloc,(char*) row->data[2], lengths[2]);
+ field->org_table= strmake_root(alloc,(char*) row->data[3], lengths[3]);
+ field->name= strmake_root(alloc,(char*) row->data[4], lengths[4]);
+ field->org_name= strmake_root(alloc,(char*) row->data[5], lengths[5]);
field->catalog_length= lengths[0];
field->db_length= lengths[1];
@@ -1202,7 +1202,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
field->flags|= NUM_FLAG;
if (default_value && row->data[7])
{
- field->def=strdup_root(alloc,(char*) row->data[7]);
+ field->def=strmake_root(alloc,(char*) row->data[7], lengths[7]);
field->def_length= lengths[7];
}
else