com php-src: plug a leak when the server ask the client for a auth protocol, that the client doesn't understand. This is 5.5 specific bug, as a result
of a refactoring in 5.5: ext/mysqlnd/mysqlnd.c
| From: | Andrey Hristov | Date: | Wed, 22 Aug 2012 18:04:42 +0000 |
| Subject: | com php-src: plug a leak when the server ask the client for a auth protocol, that the client doesn't understand. This is 5.5 specific bug, as a result of a refactoring in 5.5: ext/mysqlnd/mysqlnd.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-69925@lists.php.net to get a copy of this message | ||
Commit: 815874c646468f73d4bba3619543ab047873b5e7
Author: andrey <andrey@php.net> Wed, 22 Aug 2012 20:04:42 +0200
Parents: a90170e6f803f283d6c8e4e8d6b7bd8b7bd011a4
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=815874c646468f73d4bba3619543ab047873b5e7
Log:
plug a leak when the server ask the client for a auth protocol, that
the client doesn't understand. This is 5.5 specific bug, as a result
of a refactoring in 5.5
Changed paths:
M ext/mysqlnd/mysqlnd.c
Diff:
diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c
index 9a907a5..d7462f7 100644
--- a/ext/mysqlnd/mysqlnd.c
+++ b/ext/mysqlnd/mysqlnd.c
@@ -622,19 +622,19 @@ mysqlnd_run_authentication(
}
DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no);
} while (ret == FAIL && conn->error_info->error_no == 0 &&
switch_to_auth_protocol != NULL);
- if (plugin_data) {
- mnd_efree(plugin_data);
- }
if (ret == PASS) {
DBG_INF_FMT("saving requested_protocol=%s", requested_protocol);
conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol TSRMLS_CC);
}
-
+end:
+ if (plugin_data) {
+ mnd_efree(plugin_data);
+ }
if (requested_protocol) {
mnd_efree(requested_protocol);
}
-end:
+
DBG_RETURN(ret);
}
/* }}} */
@@ -838,6 +838,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
MYSQLND_NET * net = conn->net;
DBG_ENTER("mysqlnd_conn_data::connect");
+ DBG_INF_FMT("conn=%p", conn);
if (PASS != conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
goto err;
@@ -1149,7 +1150,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, query)(MYSQLND_CONN_DATA * conn, const char
*
size_t this_func = STRUCT_OFFSET(struct st_mysqlnd_conn_data_methods, query);
enum_func_status ret = FAIL;
DBG_ENTER("mysqlnd_conn_data::query");
- DBG_INF_FMT("conn=%llu query=%s", conn->thread_id, query);
+ DBG_INF_FMT("conn=%p conn=%llu query=%s", conn, conn->thread_id, query);
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
if (PASS == conn->m->send_query(conn, query, query_len TSRMLS_CC) &&
@@ -1883,10 +1884,10 @@ MYSQLND_METHOD(mysqlnd_conn_data, send_close)(MYSQLND_CONN_DATA * const conn
TSR
Fall-through
*/
CONN_SET_STATE(conn, CONN_QUIT_SENT);
- net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC);
/* Fall-through */
case CONN_QUIT_SENT:
/* The user has killed its own connection */
+ net->data->m.close_stream(net, conn->stats, conn->error_info TSRMLS_CC);
break;
}
@@ -2446,7 +2447,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, store_result)(MYSQLND_CONN_DATA * const conn
T
MYSQLND_RES * result = NULL;
DBG_ENTER("mysqlnd_conn_data::store_result");
- DBG_INF_FMT("conn=%llu", conn->thread_id);
+ DBG_INF_FMT("conn=%llu conn=%p", conn->thread_id, conn);
if (PASS == conn->m->local_tx_start(conn, this_func TSRMLS_CC)) {
do {