diff options
author | unknown <antony@pcg5ppc.xiphis.org> | 2007-11-01 12:30:03 -0700 |
---|---|---|
committer | unknown <antony@pcg5ppc.xiphis.org> | 2007-11-01 12:30:03 -0700 |
commit | aea5007d641042fb2ee4476663367893ee960480 (patch) | |
tree | ae4cb5021c4e27168b609e8f3fb877d3fed73189 /sql/sql_servers.cc | |
parent | be9e52135fc76fca8018ae67a915f5ba0a1fbb08 (diff) | |
download | mariadb-git-aea5007d641042fb2ee4476663367893ee960480.tar.gz |
Bug#30671
"ALTER SERVER can cause server to crash"
While retrieving values, it would erronously set the socket value
to NULL and attempt to use it in strcmp().
Ensure it is correctly set to "" so that strcmp may not crash.
mysql-test/r/federated_server.result:
results for bug30671
fix inconsistent result
mysql-test/t/federated_server.test:
surplus semicolon
test for bug30671
sql/sql_servers.cc:
bug30671
inside function get_server_from_table_to_cache()
server->socket was being set to NULL instead of empty string
Diffstat (limited to 'sql/sql_servers.cc')
-rw-r--r-- | sql/sql_servers.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index a780c561ffe..543884fdfa6 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -289,7 +289,7 @@ get_server_from_table_to_cache(TABLE *table) { /* alloc a server struct */ char *ptr; - char *blank= (char*)""; + char * const blank= (char*)""; FOREIGN_SERVER *server= (FOREIGN_SERVER *)alloc_root(&mem, sizeof(FOREIGN_SERVER)); DBUG_ENTER("get_server_from_table_to_cache"); @@ -312,7 +312,7 @@ get_server_from_table_to_cache(TABLE *table) server->port= server->sport ? atoi(server->sport) : 0; ptr= get_field(&mem, table->field[6]); - server->socket= ptr && strlen(ptr) ? ptr : NULL; + server->socket= ptr && strlen(ptr) ? ptr : blank; ptr= get_field(&mem, table->field[7]); server->scheme= ptr ? ptr : blank; ptr= get_field(&mem, table->field[8]); |