diff options
author | unknown <tsmith@quadxeon.mysql.com> | 2007-06-14 23:23:30 +0200 |
---|---|---|
committer | unknown <tsmith@quadxeon.mysql.com> | 2007-06-14 23:23:30 +0200 |
commit | cb93ff4d02ef0b0d3f4722572d8851da5ac9e1bb (patch) | |
tree | a2e6d7b3fecd15d53e148269e3dbb13aa08370b3 /sql/sql_parse.cc | |
parent | 863a953e1d9621d03d17c4c347898a6d09d5aa6f (diff) | |
parent | dc6c3b31d8c50994ae0b7673ef55437c336daed4 (diff) | |
download | mariadb-git-cb93ff4d02ef0b0d3f4722572d8851da5ac9e1bb.tar.gz |
Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-build
into quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun14/50
configure.in:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/binlog.result:
Auto merged
mysql-test/r/have_log_bin.require:
Auto merged
BitKeeper/deleted/.del-ctype_cp932_notembedded.test:
Auto merged
mysql-test/t/binlog.test:
Auto merged
mysql-test/t/ctype_cp932_binlog.test:
Auto merged
mysql-test/t/ctype_ucs_binlog.test:
Auto merged
mysql-test/t/flush_block_commit_notembedded.test:
Auto merged
mysql-test/t/insert_select-binlog.test:
Auto merged
mysql-test/t/mysqlbinlog-cp932.test:
Auto merged
mysql-test/t/mysqldump.test:
Auto merged
mysql-test/t/sp_trans.test:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
mysql-test/r/mix_innodb_myisam_binlog.result:
Use local
mysql-test/t/blackhole.test:
manual merge
mysql-test/t/drop_temp_table.test:
manual merge
mysql-test/t/mix_innodb_myisam_binlog.test:
Use local
mysql-test/t/mysqlbinlog.test:
Use local
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c9baecd9cf1..cf8209978a3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1009,9 +1009,12 @@ static int check_connection(THD *thd) Old clients send null-terminated string as password; new clients send the size (1 byte) + string (not null-terminated). Hence in case of empty password both send '\0'. + + Cast *passwd to an unsigned char, so that it doesn't extend the sign for + *passwd > 127 and become 2**32-127 after casting to uint. */ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ? db + passwd_len + 1 : 0; uint db_len= db ? strlen(db) : 0; @@ -1697,11 +1700,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd, Old clients send null-terminated string ('\0' for empty string) for password. New clients send the size (1 byte) + string (not null terminated, so also '\0' for empty string). + + Cast *passwd to an unsigned char, so that it doesn't extend the sign + for *passwd > 127 and become 2**32-127 after casting to uint. */ char db_buff[NAME_LEN+1]; // buffer to store db in utf8 char *db= passwd; uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db+= passwd_len + 1; #ifndef EMBEDDED_LIBRARY /* Small check for incoming packet */ |