summaryrefslogtreecommitdiffstats
path: root/bug81719.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-06-23 08:28:53 +0200
committerRemi Collet <remi@php.net>2022-06-23 08:28:53 +0200
commitd0d97e334e041b6d44de8bb9f7f8e15a205241ef (patch)
tree93599d31b836a37b846f2b2a532f1d5cadd5dfe2 /bug81719.patch
parenta50888886df92c5c7fed5cc7a74bd65911cd322b (diff)
myqlnd: fix #81719: mysqlnd/pdo password buffer overflow. CVE-2022-31626HEADmaster
Diffstat (limited to 'bug81719.patch')
-rw-r--r--bug81719.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/bug81719.patch b/bug81719.patch
new file mode 100644
index 0000000..37eda17
--- /dev/null
+++ b/bug81719.patch
@@ -0,0 +1,29 @@
+From 569b03f03929588741bb3dce5168d70805838143 Mon Sep 17 00:00:00 2001
+From: Stanislav Malyshev <smalyshev@gmail.com>
+Date: Mon, 6 Jun 2022 00:56:51 -0600
+Subject: [PATCH] Fix bug #81719: mysqlnd/pdo password buffer overflow
+
+(cherry picked from commit 58006537fc5f133ae8549efe5118cde418b3ace9)
+(cherry picked from commit 9433de72e291db518357fe55531cc15432d43ec4)
+(cherry picked from commit 1560224d3a26574f0195af3853e4d7e050b0b06f)
+(cherry picked from commit 5e1d9182748c5330c4bf2154da858206e76914b6)
+(cherry picked from commit 1f8f48703c7800b0e90344ccd73e74a1727f8a72)
+(cherry picked from commit e47e59289578140103efd03fcd58ea24776a6347)
+---
+ ext/mysqlnd/mysqlnd_wireprotocol.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
+index 844330fbf10..6e5c539d149 100644
+--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
++++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
+@@ -763,7 +763,8 @@ static size_t
+ php_mysqlnd_change_auth_response_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
+ {
+ MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *packet= (MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *) _packet;
+- zend_uchar * buffer = conn->net->cmd_buffer.length >= packet->auth_data_len? conn->net->cmd_buffer.buffer : mnd_emalloc(packet->auth_data_len);
++ size_t total_packet_size = packet->auth_data_len + MYSQLND_HEADER_SIZE;
++ zend_uchar * buffer = conn->net->cmd_buffer.length >= total_packet_size? conn->net->cmd_buffer.buffer : mnd_emalloc(total_packet_size);
+ zend_uchar *p = buffer + MYSQLND_HEADER_SIZE; /* start after the header */
+
+ DBG_ENTER("php_mysqlnd_change_auth_response_write");