diff options
author | unknown <heikki@hundin.mysql.fi> | 2002-05-09 20:22:26 +0300 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2002-05-09 20:22:26 +0300 |
commit | 77957ae868263b7439289d7ae3a79e858f32427c (patch) | |
tree | 2028f79dc404fe80b3d47b451d386704a57f9238 /innobase | |
parent | 479aed7658859e076b28fb99f1a61ee5f13d8192 (diff) | |
download | mariadb-git-77957ae868263b7439289d7ae3a79e858f32427c.tar.gz |
row0mysql.c:
Play safe and set a MySQL 1 - 12 byte BLOB reference to zero except for the length and pointer areas in it
innobase/row/row0mysql.c:
Play safe and set a MySQL 1 - 12 byte BLOB reference to zero except for the length and pointer areas in it
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/row/row0mysql.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 9bc524189fd..1dfb1c4ee77 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -66,13 +66,23 @@ row_mysql_store_blob_ref( byte* dest, /* in: where to store */ ulint col_len, /* in: dest buffer size: determines into how many bytes the BLOB length is stored, - this may vary from 1 to 4 bytes */ - byte* data, /* in: BLOB data */ - ulint len) /* in: BLOB length */ + the space for the length may vary from 1 + to 4 bytes */ + byte* data, /* in: BLOB data; if the value to store + is SQL NULL this should be NULL pointer */ + ulint len) /* in: BLOB length; if the value to store + is SQL NULL this should be 0; remember + also to set the NULL bit in the MySQL record + header! */ { ulint sum = 0; ulint i; + /* MySQL might assume the field is set to zero except the length and + the pointer fields */ + + memset(dest, '\0', col_len); + /* In dest there are 1 - 4 bytes reserved for the BLOB length, and after that 8 bytes reserved for the pointer to the data. In 32-bit architectures we only use the first 4 bytes of the pointer |