summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-05-25 17:24:17 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-05-25 17:24:17 +0500
commitc326457d78af9a27ad58a74c31125594d9fc2a75 (patch)
tree91734a0f33f0d1b72f30bf63cc3780026a610b49 /client
parentc57d6f729db784d02a0d0d62f1f9d03ab22fcfda (diff)
downloadmariadb-git-c326457d78af9a27ad58a74c31125594d9fc2a75.tar.gz
Fixed bug #28522:
sometimes `mysqldump --hex-blob' overruned output buffer by '\0' byte. The dump_table() function has been fixed to reserve 1 byte more for the last '\0' byte of dumped string. client/mysqldump.c: Fixed bug #28522. The dump_table() function has been fixed to reserve 1 byte more for the last '\0' byte of dumped string. mysql-test/t/mysqldump.test: Updated test case for bug #28522. mysql-test/r/mysqldump.result: Updated test case for bug #28522.
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 4f908b531b1..26235efafce 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2529,15 +2529,18 @@ static void dump_table(char *table, char *db)
plus 2 bytes for '0x' prefix.
- In non-HEX mode we need up to 2 bytes per character,
plus 2 bytes for leading and trailing '\'' characters.
+ Also we need to reserve 1 byte for terminating '\0'.
*/
- dynstr_realloc_checked(&extended_row,length * 2+2);
+ dynstr_realloc_checked(&extended_row,length * 2 + 2 + 1);
if (opt_hex_blob && is_blob)
{
dynstr_append_checked(&extended_row, "0x");
extended_row.length+= mysql_hex_string(extended_row.str +
extended_row.length,
row[i], length);
- extended_row.str[extended_row.length]= '\0';
+ DBUG_ASSERT(extended_row.length+1 <= extended_row.max_length);
+ /* mysql_hex_string() already terminated string by '\0' */
+ DBUG_ASSERT(extended_row.str[extended_row.length] == '\0');
}
else
{