Skip to content

Commit f3d69e6

Browse files
committed
Add missing check in mysqlnd_auth.c
1 parent 391ec27 commit f3d69e6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

ext/mysqlnd/mysqlnd_auth.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,13 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
920920
ret[passwd_len] = '\0';
921921
} else {
922922
*auth_data_len = 0;
923+
924+
if (auth_plugin_data_len < SCRAMBLE_LENGTH) {
925+
SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, "The server sent wrong length for scramble");
926+
DBG_ERR_FMT("The server sent wrong length for scramble %zu. Expected %u", auth_plugin_data_len, SCRAMBLE_LENGTH);
927+
DBG_RETURN(NULL);
928+
}
929+
923930
server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, pfc_data);
924931

925932
if (server_public_key) {

0 commit comments

Comments
 (0)