Skip to content

Commit 15f1b33

Browse files
committed
Fix reconstruct problems for MySQL replay
1 parent d204ad9 commit 15f1b33

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

pairs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ retrieve_mysql_user_pwd_info(tc_pool_t *pool, char *pairs)
7070
next = strchr(p, ',');
7171
q = strchr(p, '@');
7272

73-
if ( next != NULL) {
73+
if (next != NULL) {
7474
if (next != p) {
7575
pair_end = next - 1;
7676
} else {
@@ -81,7 +81,7 @@ retrieve_mysql_user_pwd_info(tc_pool_t *pool, char *pairs)
8181
pair_end = p + strlen(p) - 1;
8282
}
8383

84-
if ((q-p) >= 256 || (pair_end - q) >= 256) {
84+
if ((q - p) >= 256 || (pair_end - q) >= 256) {
8585
tc_log_info(LOG_WARN, 0, "too long for user or password");
8686
return -1;
8787
}
@@ -103,7 +103,7 @@ retrieve_mysql_user_pwd_info(tc_pool_t *pool, char *pairs)
103103
} else {
104104
break;
105105
}
106-
} while (p < end) ;
106+
} while (p < end);
107107

108108
return 0;
109109
}

tc_mysql_module.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,16 @@ prepare_for_renew_session(tc_sess_t *s, tc_iph_t *ip, tc_tcph_t *tcp)
346346
static int
347347
proc_when_sess_created(tc_sess_t *s, tc_iph_t *ip, tc_tcph_t *tcp)
348348
{
349-
tc_mysql_session *data;
350-
351-
data = (tc_mysql_session *) tc_pcalloc(s->pool, sizeof(tc_mysql_session));
349+
tc_mysql_session *data = s->data;
352350

353-
if (data) {
354-
s->data = data;
351+
if (data == NULL) {
352+
data = (tc_mysql_session *) tc_pcalloc(s->pool, sizeof(tc_mysql_session));
353+
354+
if (data) {
355+
s->data = data;
356+
}
357+
} else {
358+
tc_memzero(data, sizeof(tc_mysql_session));
355359
}
356360

357361
return TC_OK;

0 commit comments

Comments
 (0)