1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 23:18:13 +02:00
Commit Graph

1683 Commits

Author SHA1 Message Date
Mikhail Galanin 7e7817bc2f Avoid using uninitialised struct
Closes GH-12046.
2023-11-25 20:07:14 +01:00
Niels Dossche 14fc3d1566 Fix GH-12297: PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd.so' in Unknown on line
On some configurations, the COMPILE_DL_MYSQLND must come from config.h.
If it isn't set, the get_module function won't be exposed, resulting in
a failure when trying to load the library.
It's the same issue ext/fileinfo had a while back that was fixed in
b0ba368d5.

Closes GH-12299.
2023-09-26 21:41:45 +02:00
Kamil Tekiela c1103a9772 Fix implicit/explicit port in mysqlnd 2023-08-16 18:59:07 +01:00
Kamil Tekiela 0d922aa595 Fix error checking in mysqlnd
Closes GH-11925
2023-08-10 15:23:54 +01:00
Yurun ca5d48213a Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
Closes GH-11551.
2023-08-04 22:25:01 +01:00
Niels Dossche 509906b2a5 Fix GH-11438: mysqlnd fails to authenticate with sha256_password accounts using passwords longer than 19 characters
https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html
tells us that the nonce used in this authentication method is 20 bytes
long. However, we might receive additional scramble data in
php_mysqlnd_greet_read not used in this method.
On my test setup, I received 21 bytes (20 bytes + '\0'). This resulted
in the xor computation to incorrectly include the NUL byte. Every
password of at least 20 characters therefore failed to authenticate
using this method.

Looking at mysql-server source code also seems to reveal that it always
uses a fixed number of scramble bytes [1].

[1] https://github.com/mysql/mysql-server/blob/ea7087d885006918ad54458e7aad215b1650312c/sql/auth/sha2_password.cc#L1078-L1079

Closes GH-11445.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2023-08-03 20:28:11 +02:00
nielsdos 94127c53aa Fix GH-11440: authentication to a sha256_password account fails over SSL
This is similar to bug #78680, but that bug wasn't really fixed in all
places. This is the only remaining place.

Closes GH-11444.
2023-08-02 20:30:49 +02:00
Niels Dossche 8930bf8c33 Fix GH-8979: Possible Memory Leak with SSL-enabled MySQL connections
The stream context inside `mysqlnd_vio::enable_ssl()` is leaking.
In particular: when `php_stream_context_set()` get called the refcount
of `context` is increased by 1, which means that `context` will now
have a refcount of 2. Later on we remove the context from the stream
by calling `php_stream_context_set(stream, NULL)` but that leaves our
`context` with a refcount of 1, and therefore it's never destroyed.
In my test case this yielded a leak of 1456 bytes per connection
(but could be more depending on your settings ofc).

Annoyingly, Valgrind doesn't find it because the context is still
in the `EG(regular_list)` and will thus be destroyed at the end of
the request. However, I still think this bug needs to be fixed because
as the users in the issue report already mentioned:
there can be long-running PHP scripts.

Fix it by decreasing the refcount to transfer the ownership.

Closes GH-10909.
2023-03-24 18:03:29 +01:00
Kamil Tekiela ec1f58c871 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Add NEWS entry for #9841
  Add a temporary fix for insufficient buffer size in mysqlnd (#9835)
  mysqli_query throws warning despite using silenced error mode (#9842)
2022-10-27 18:31:38 +01:00
Kamil Tekiela e713a8e8e5 Add a temporary fix for insufficient buffer size in mysqlnd (#9835) 2022-10-27 18:25:17 +01:00
Christoph M. Becker 7e14d2466a Fix potential heap corruption due to alignment mismatch
The fix for bug 63327[1] changed the extra size of mysqlnd allocations
from `sizeof(size_t)` to the properly aligned values; however, the
allocation in `_mysqlnd_pestrdup()` has apparently been overlooked,
which (currently) causes detectable heap corruption when running
mysqli_get_client_stats.phpt on 32bit Windows versions.

[1] <https://github.com/php/php-src/commit/338a47bb856872f9ab0db94e867333d73279ca85>

Closes GH-9724.
2022-10-13 11:47:24 +02:00
Arnaud Le Blanc d4b99542d5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Return immediately when FD_SETSIZE is exceeded (#9602)
2022-10-01 11:23:34 +02:00
Arnaud Le Blanc 80232de0e4 Return immediately when FD_SETSIZE is exceeded (#9602) 2022-10-01 11:20:43 +02:00
Pierrick Charron 77ba689fd6 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-10 12:44:39 -04:00
Pierrick Charron df4dd82ea0 Fix bad integer promotion in mysqlnd big5 charset detection 2022-06-10 12:41:54 -04:00
Stanislav Malyshev 98e1291b7e Merge branch 'PHP-8.0' into PHP-8.1 2022-06-06 01:11:44 -06:00
Stanislav Malyshev e864cb61a7 Merge branch 'PHP-7.4' into PHP-8.0 2022-06-06 01:11:13 -06:00
Stanislav Malyshev 58006537fc Fix bug #81719: mysqlnd/pdo password buffer overflow 2022-06-06 00:56:51 -06:00
Kamil Tekiela ced5581eca Fix mnd_malloc -> mnd_emalloc from previous merge 2022-03-31 10:53:58 +01:00
Kamil Tekiela 40b20d8215 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix regression from #8058
2022-03-31 10:32:59 +01:00
Kamil Tekiela 06e383b2f4 Fix regression from #8058
Closes GH-8181
2022-03-31 10:31:52 +01:00
Kamil Tekiela 2bae4e8dbb Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix bug GH-8058 - mysqlnd segfault when prepare fails
2022-02-14 12:02:57 +00:00
Kamil Tekiela 93a8d5cd17 Fix bug GH-8058 - mysqlnd segfault when prepare fails
Closes GH-8061
2022-02-14 11:45:17 +00:00
Kamil Tekiela 1605e6fd9f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix coding style from previous commit
2022-01-20 11:18:03 +00:00
Kamil Tekiela 82b883034c Fix coding style from previous commit 2022-01-20 11:17:18 +00:00
Kamil Tekiela 1f0661d3e5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Strip MariaDB 10 prefix
2022-01-19 21:45:19 +00:00
Kamil Tekiela 5fc0db989e Strip MariaDB 10 prefix
Closes GH-7972
2022-01-19 21:39:42 +00:00
Christoph M. Becker ae9e98640a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix bug where large bigints may be truncated
2021-12-30 19:10:36 +01:00
NathanFreeman b3903515bf Fix bug where large bigints may be truncated
Unless stringified results are requested, we need to parse large
bigints as unsigned, to avoid wrap-around behavior.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-7837.
2021-12-30 19:07:36 +01:00
Nikita Popov d001682ac4 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed bug #81494
2021-10-08 15:02:29 +02:00
Nikita Popov df940a6dc3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81494
2021-10-08 15:00:51 +02:00
Nikita Popov fcabe693ba Fixed bug #81494
Use the proper error reporting mechanism rather than throwing a
warning. This requires something of a hack because we don't have
direct access to the connection object at this point.
2021-10-08 15:00:10 +02:00
Kamil Tekiela a893a4901f Implement mysqlnd_set_persistent_string (#7371) 2021-08-20 12:03:46 +01:00
Kamil Tekiela d902b3a844 Replace macro with inline function (#7365) 2021-08-13 20:03:26 +01:00
Nikita Popov b80767e219 Remove MYSQLND_SZ_T_SPEC
In favor of %zu, which msvc has supported for quite a while already.
2021-08-12 15:29:06 +02:00
Nikita Popov 8f5555605a Remove unused mysqlnd portability macros 2021-08-12 15:25:03 +02:00
Nikita Popov 277e169ef3 Remove mysqlnd local_tx functionality
These are not used in-tree and cause unnecessary complexity and
untestable failure modes.
2021-08-12 15:21:21 +02:00
Nikita Popov 1c675b9d0d Switch mysqlnd auth to EVP_PKEY API 2021-08-10 12:36:44 +02:00
Nikita Popov d28f6e694d Move php_gcvt to zend_gcvt
Also move PHP_DOUBLE_MAX_LENGTH to ZEND_DOUBLE_MAX_LENGTH.
2021-08-02 14:51:46 +02:00
Kamil Tekiela 132d499424 Drop mysqlnd statistics triggers
This functionality is not used productively in PHP and it's not used in
any of the extensions to my knowledge. Since it looks like this functionality
isn't required by anyone, let's clean up mysqlnd and drop it.
2021-07-29 14:21:13 +01:00
Kamil Tekiela fb85731c67 Remove get_parameter_metadata 2021-07-29 14:21:13 +01:00
Kamil Tekiela 254d1641bb Remove mysqlnd_field_type_name 2021-07-29 14:21:13 +01:00
Kamil Tekiela d2ccea1381 Remove wrappers for *printf functions (#7313) 2021-07-28 10:24:46 +02:00
Kamil Tekiela abacd91cc8 Merge branch 'PHP-8.0'
* PHP-8.0:
  Prevent mysqli::next_result from reporting errors from previous calls (#7304)
2021-07-27 11:57:39 +01:00
Kamil Tekiela 65e2dbd0de Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Prevent mysqli::next_result from reporting errors from previous calls (#7304)
2021-07-27 11:56:14 +01:00
Kamil Tekiela d26069a2f1 Prevent mysqli::next_result from reporting errors from previous calls (#7304) 2021-07-27 11:50:28 +01:00
Nikita Popov 338a47bb85 Fix bug #63327
Use ZEND_MM_ALIGNED_SIZE for the extra size information.
I don't have a relevant system to test, but this should fix the
issue as long as required alignment is detected correctly.
2021-07-23 10:29:44 +02:00
Nikita Popov efbb2198d4 Return value from ZEND_ATOL
Instead of assigning it as part of the macro itself, which makes
usage quite awkward.
2021-07-12 16:51:24 +02:00
Patrick Allaert aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov c492c90a6e Fix mysqlnd debug formats on 32-bit 2021-06-16 17:08:20 +02:00