1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Fix for CONC-384:

fixed length calculation for connection attributes. We now call mysql_net_store_length passing the size of the connection attribute and substract the offset of the passed buffer to determine the correct size.
This commit is contained in:
Georg Richter
2019-02-07 04:14:55 +01:00
parent 1e5e21cae9
commit 70f2964dc4
2 changed files with 29 additions and 7 deletions

View File

@@ -2627,13 +2627,13 @@ mysql_get_client_info(void)
static size_t get_store_length(size_t length)
{
if (length < (size_t) L64(251))
return 1;
if (length < (size_t) L64(65536))
return 2;
if (length < (size_t) L64(16777216))
return 3;
return 9;
#define MAX_STORE_SIZE 9
unsigned char buffer[MAX_STORE_SIZE], *p;
/* We just store the length and substract offset of our buffer
to determine the length */
p= mysql_net_store_length(buffer, length);
return p - buffer;
}
uchar *ma_get_hash_keyval(const uchar *hash_entry,