diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index c48bff627eeb..ff57916e8c9a 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -463,6 +463,7 @@ php_mysqlnd_greet_read(MYSQLND_CONN_DATA * conn, void * _packet) if ((size_t) (p - buf) < packet->header.size) { /* auth_plugin_data is split into two parts */ + BAIL_IF_NOT_ENOUGH_DATA_EX(SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323 + 1); memcpy(packet->authentication_plugin_data.s + SCRAMBLE_LENGTH_323, p, SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323); p+= SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323; p++; /* 0x0 at the end of the scramble and thus last byte in the packet in 5.1 and previous */