Skip to content

Commit 8493e27

Browse files
smalyshevramsey
authored andcommittedJun 7, 2022
Fix bug #81719: mysqlnd/pdo password buffer overflow
1 parent 5ed5954 commit 8493e27

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎ext/mysqlnd/mysqlnd_wireprotocol.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,8 @@ php_mysqlnd_change_auth_response_write(MYSQLND_CONN_DATA * conn, void * _packet)
776776
MYSQLND_VIO * vio = conn->vio;
777777
MYSQLND_STATS * stats = conn->stats;
778778
MYSQLND_CONNECTION_STATE * connection_state = &conn->state;
779-
zend_uchar * const buffer = pfc->cmd_buffer.length >= packet->auth_data_len? pfc->cmd_buffer.buffer : mnd_emalloc(packet->auth_data_len);
779+
size_t total_packet_size = packet->auth_data_len + MYSQLND_HEADER_SIZE;
780+
zend_uchar * const buffer = pfc->cmd_buffer.length >= total_packet_size? pfc->cmd_buffer.buffer : mnd_emalloc(total_packet_size);
780781
zend_uchar * p = buffer + MYSQLND_HEADER_SIZE; /* start after the header */
781782

782783
DBG_ENTER("php_mysqlnd_change_auth_response_write");

0 commit comments

Comments
 (0)