summaryrefslogtreecommitdiff
path: root/libmysql/libmysql.c
diff options
context:
space:
mode:
authorunknown <kroki@mysql.com>2006-06-30 12:52:05 +0400
committerunknown <kroki@mysql.com>2006-06-30 12:52:05 +0400
commit86155590380cc7a69e330ccf8ba7790475875a1a (patch)
treeb15d181ea088a873081fce94ac611bdbf7fb05fe /libmysql/libmysql.c
parent79952ec0d044d0c561f777e02a56c6981949dfcc (diff)
downloadmariadb-git-86155590380cc7a69e330ccf8ba7790475875a1a.tar.gz
bug #20152: mysql_stmt_execute() overwrites parameter buffers
When using a parameter bind MYSQL_TYPE_DATE in a prepared statement, the time part of the MYSQL_TIME buffer was written to zero in mysql_stmt_execute(). The param_store_date() function in libmysql.c worked directly on the provided buffer. Changed to use a copy of the buffer. libmysql/libmysql.c: fix for bug #20152 tests/mysql_client_test.c: added test for bug#20152
Diffstat (limited to 'libmysql/libmysql.c')
-rw-r--r--libmysql/libmysql.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 4b8f1c9da1f..80a7112eab2 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2409,10 +2409,9 @@ static void net_store_datetime(NET *net, MYSQL_TIME *tm)
static void store_param_date(NET *net, MYSQL_BIND *param)
{
- MYSQL_TIME *tm= (MYSQL_TIME *) param->buffer;
- tm->hour= tm->minute= tm->second= 0;
- tm->second_part= 0;
- net_store_datetime(net, tm);
+ MYSQL_TIME tm= *((MYSQL_TIME *) param->buffer);
+ tm.hour= tm.minute= tm.second= tm.second_part= 0;
+ net_store_datetime(net, &tm);
}
static void store_param_datetime(NET *net, MYSQL_BIND *param)