Skip to content

Commit 5800653

Browse files
committed
Fix bug #81719: mysqlnd/pdo password buffer overflow
1 parent 55f6895 commit 5800653

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,8 @@ php_mysqlnd_change_auth_response_write(MYSQLND_CONN_DATA * conn, void * _packet)
771771
MYSQLND_VIO * vio = conn->vio;
772772
MYSQLND_STATS * stats = conn->stats;
773773
MYSQLND_CONNECTION_STATE * connection_state = &conn->state;
774-
zend_uchar * const buffer = pfc->cmd_buffer.length >= packet->auth_data_len? pfc->cmd_buffer.buffer : mnd_emalloc(packet->auth_data_len);
774+
size_t total_packet_size = packet->auth_data_len + MYSQLND_HEADER_SIZE;
775+
zend_uchar * const buffer = pfc->cmd_buffer.length >= total_packet_size? pfc->cmd_buffer.buffer : mnd_emalloc(total_packet_size);
775776
zend_uchar * p = buffer + MYSQLND_HEADER_SIZE; /* start after the header */
776777

777778
DBG_ENTER("php_mysqlnd_change_auth_response_write");

0 commit comments

Comments
 (0)