1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-10 01:02:57 +03:00
Commit Graph

181 Commits

Author SHA1 Message Date
Georg Richter
6bf9557d00 CONC-709: Fix crash when sending NULL_LENGTH in field description
Instead of checking the lengths given by two offsets, we have to
check if NULL_LENGTH was sent before (and return an error).
2024-12-12 10:40:30 +01:00
Georg Richter
294b933606 CONC-708: buffer over-/underflow in ma_read_ok_packet
Added a helper function ma_check_buffer_bounaaries which
checks possible boffer over- or underflows when processing
ok packet.^
2024-12-10 08:01:37 +01:00
Georg Richter
554893c269 CONC-711: Ubsan and ASAN fixes
- fixed write functions in my_auth.c
- fixed misalignment error when obtaining data via
  option MARIADB_OPT_USERDATA (mysql_get_optionv).
2024-12-09 19:28:10 +01:00
Georg Richter
6bd5b6746f Follow up fix for CONC-696
According to next_thread_id() in mysqld.cc the
thread id is limited to 4 bytes. Thanks to Vlad
for pointing out
2024-05-14 09:45:51 +02:00
Georg Richter
d5394838fd CONC-696: Replace COM_PROCESS_KILL by KILL command
Since COM_PROCESS_KILL isn't supported by newer MySQL
versions.
2024-05-13 15:57:39 +02:00
Georg Richter
9f37c27bc8 Fix for CONC-668:
Fix build error on 32-bit systems.
2023-09-18 16:05:00 +02:00
Georg Richter
8ab517cbc1 Use OPT_SET_EXT_VALUE macro instead of assigning value
directly.
2023-07-13 10:58:15 +02:00
Georg Richter
45feebb99d Remove server certification verification
Since the server certification option is used by client
only, there is no need to have this flag in server and or
client capabilities. The server itself validates client
certificate depending on the user definition.
2023-07-13 09:30:33 +02:00
Marko Mäkelä
d543bed61b Fix GCC 13 -Wmaybe-uninitialized 2023-06-26 10:59:14 +03:00
Georg Richter
a3bba4639f CONC-619: NULL pointer dereference in unpack_fields
Fixed NULL pointer dereference, thanks to Yury Chaikou which
reported this issue.
2023-05-02 17:59:18 +02:00
Georg Richter
0e452f66ac MariaDB Server detection fix
Use mariadb_connection() instead of checking 5.5.5 rpl hack
to detect if we are connected to a MariaDB Server.
2023-04-21 07:11:29 +02:00
Georg Richter
2000b06183 Replace SET_CLIENT_STMT_ERROR by stmt_set_error(). 2023-04-11 18:31:19 +02:00
Georg Richter
17d4f38403 Fix for CONC-642: Set CR_OUT_OF_MEMORY error
Set CR_OUT_OF_MEMORY error in mysql_use_result() api function
if allocation of memory failed.
2023-03-30 13:30:53 +02:00
Georg Richter
75439c0f39 CONC-632
When resetting the connection with mysql reset_connection(), the
server_status must be checked and any other resultsets that mayi
exist must be removed.
2023-02-08 11:46:39 +01:00
Georg Richter
d204e83104 Return correct client library version number instead of
server number in mysql_get_client_versio
2023-01-16 14:14:59 +01:00
Georg Richter
d712484dab Set MARIADB_PACKAGE_VERSION instead of
MARIADB_CLIENT_VERSION_STR for obtaining client_info.
2023-01-16 13:56:22 +01:00
Georg Richter
bf82b2d8cb Fix for CONC-624:
- ER() macro now checks if the error code is known, if not it will return
  "Unknown or undefined error code" (instead of crashing)
- SET_CLIENT_STMT_ERROR now maps to stmt_set_error and accepts variadic
  arguments
2023-01-15 14:11:54 +01:00
Georg Richter
9a572bc548 Fix for CONC-604 and CONC-605:
This patch fixes a crash when reconnectiong via TLS.
2022-07-18 11:41:46 +02:00
Georg Richter
ab7a81e79e Added new macro OPT_SET_EXTENDED_VALUE_BIN
OPT_SET_EXTENDED_VALUE_BIN can be used to set
binary values for options:
OPT_SET_EXTENDED_VALUE_BIN(options, key, key_len, val, len)
2022-04-30 05:37:31 +02:00
Georg Richter
f75a819efd Post fix for CONC-588
Instead to allocate procy header string the poiter was assigned
to extended options.
2022-04-29 16:30:27 +02:00
Georg Richter
3ce51b0b3e Fix for CONC-587:
Since alerts may happen after handshake (for example with described
test in CONC-587 using TLSv1.3 protocol or by renegotiation) the
tls error message needs to be retrieved if error is a protocol error
(SSL_ERROR_SSL) and/or if errno was not set.
2022-04-20 18:48:54 +02:00
Georg Richter
f192d3d1ba Fix for CONC-588:
Free proxy_header (allocated via MARIADB_OPT_PROXY_HEADER option)
when closing connection.
2022-04-19 06:27:32 +02:00
Sergei Golubchik
43b60edc92 use mariadb_connection() to detect whether the server is MariaDB 2021-12-25 17:23:38 +01:00
Georg Richter
f6b8fe10c3 Fix for CONC-568:
If multiple threads attempt to connect to a server using a
dynamically loaded authentication plugin the error
"plugin is already loaded" might occur. This is caused
by a race condition if one thread waits for a lock to
load the plugin, while another process which obtained the lock
already loaded the plugin.

The API function mysql_load_plugin_v() now returns
the plugin handle (instead of raising an error and returning
a NULL handle) even if the plugin was already loaded.
2021-10-08 10:20:23 +02:00
Georg Richter
d19c7c6926 Fix for CONC-543 (hash functions conflict with GnuTLS)
To allow static linking with GnuTLS hash lookup functions are now
prefixed with ma_hashtbl_. The files hash.c and hash.h were renamed
to ma_hashtbl.c and ma_hashtbl.h
2021-04-13 21:34:29 +02:00
Georg Richter
2ff01c121c Fix for CONC-518:
Check if mysql->options.extension was allocated before checking
async_context: this is handled by IS_MYSQL_ASYNC() macro now.
2020-11-27 18:33:06 +01:00
Georg Richter
820faff627 codespell fixes, removed MSDOS preprocessor macros 2020-11-26 09:07:17 +01:00
Georg Richter
b2966c05e4 Revert "MDEV-19237 - do not resend prepared statement metadata unnecessarily":
This reverts commit ed4d747510.
2020-10-20 14:57:22 +02:00
Vladislav Vaintroub
ed4d747510 MDEV-19237 - do not resend prepared statement metadata unnecessarily
fix warnings
2020-10-15 22:25:09 +02:00
Vladislav Vaintroub
c0837c3b8d MDEV-21612 Remove COM_MULTI.
The server command code 254 is now reserved,
as well as corresponding protocol flag.

Do not reuse them.
2020-09-22 17:26:04 +02:00
xantares
9d7c233e8d Fix include on case-sensitive fs
shlwapi is lowercase on case-sensitive file-systems
2020-09-12 14:29:56 +02:00
Georg Richter
29a3396456 CONC-302: Added support for SESSION_TRACK_GTIDS (MySQL server) 2020-09-12 10:58:33 +02:00
Georg Richter
3e699a1738 CONC-496: Added support for SESSION_TRACK_TRANSACTION_STATE in ok packet 2020-09-10 14:03:00 +02:00
Dianne Skoll
73dfd1ee48 Clear out free'd pointers for safety. 2020-08-13 14:16:29 -04:00
Sergei Golubchik
2759b87d72 sanity checks for client-supplied OK packet content
reported by Matthias Kaiser, Apple Information Security
2020-05-07 15:06:32 +02:00
Sergei Golubchik
ca8f94f727 BUG#29597896 - NULL POINTER DEREFERENCE IN LIBMYSQL
CONC version of server commit e8e67bd4a4c
2020-05-04 09:14:45 +02:00
Marko Mäkelä
7a2c052ffc MemorySanitizer: Avoid calling uninstrumented getservbyname() 2020-03-28 20:12:43 +02:00
Georg Richter
8c773db1fb Fix for CONC-441:
Instead of getlogin() we first try to determine the current user of the process
by calling getpwuid(). If for some reaon getpwuid() will fail, we will use getlogin() instead.
2020-03-12 18:09:40 +01:00
Georg Richter
f9a50468cd Merge pull request #129 from ottok/3.1-fix-spelling
Fix typo in output string: inital -> initial
2020-03-11 08:25:59 +01:00
Alexander Barkov
6632cb69d7 MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY 2020-03-10 17:02:59 +04:00
Georg Richter
d4f75481f6 Fix for CONC-458:
Fixed crash in mysql_get_timeout and mysql_get_timeout_ms functions,
which happened when no asynchronous context was set before.
2020-03-05 09:50:12 +01:00
Otto Kekäläinen
c0d5d7d15b Fix typo in output string: inital -> initial 2020-03-04 20:05:56 +02:00
Georg Richter
6a0c8ff2e5 Fix for CONC-457:
mysql_list_processlists was marked as deprecated in MySQL 4.0 and not
updated anymore. It exists still in latest MySQL and MariaDB connectors.
It now supports the 4.1 protocol, using 7 instead of 5 fields.

The following functions are now marked deprecated in source:
* mysql_list_dbs
* mysql_list_tables
* mysql_list_processes
2020-02-28 12:56:37 +01:00
Georg Richter
1218ffac1a Fix for CONC-452 and CONC-453:
Various coverity scan fixes, including CONC-452 and CONC-453.
Special thanks to Lukas Javorsky for fixing numerous covscan
issues (This patch includes part of his pull request #126).

Coverity scan build was using the following cmake parameters:
-WITH_EXTERNAL_ZLIB=ON -DWITH_UNIT_TESTS=OFF.

CWE-416 (use after free) in dtoa.c (from netlib) is still open.
2020-02-14 09:52:21 +01:00
Georg Richter
17ba6affa9 Fix for mysql_set_character_set:
Give a more detailled error information, in case SET NAMES failed.
2020-02-06 10:08:32 +01:00
Georg Richter
a1283d0b10 cleanup (patch provided by Alexander Barkov)
move function prototypes used in mariadb_lib.c and mariadb_stmt.c
to include/ma_priv.h
2020-01-20 17:44:49 +01:00
Oleksandr Byelkin
42be9e67d8 Bug#29630767 - USE OF UNINITIALIZED VALUE IN LIBMYSQL (CLIENT.CC FUNCTION RUN_PLUGIN_AUTH) 2020-01-20 11:14:21 +01:00
Oleksandr Byelkin
980f2dbea6 Typo fixed 2019-10-31 06:06:39 +01:00
Georg Richter
a0cbee900b Schannel fix for 9ba8e32f6d
When we try to reconnect we need to set CLIENT_REMEMBER_OPTIONS otherwise
new connection will not be secure.
2019-10-11 16:39:01 +02:00
Georg Richter
0235aa6adc Fixed gcc warning (missing const qualifier) 2019-10-08 14:18:01 +02:00