Skip to content

Commit a1d8c62

Browse files
committed
Make ext-salt check more robust. Fixes #1606
Don't assume the exact length of the salt, but just check the prefix.
1 parent 78513df commit a1d8c62

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/MySqlConnector/Core/ServerSession.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,8 @@ private async Task<PayloadData> SwitchAuthenticationAsync(ConnectionSettings cs,
945945
payload = await ReceiveReplyAsync(ioBehavior, cancellationToken).ConfigureAwait(false);
946946
var extendedSalt = payload.Span;
947947

948-
// MariaDB 11.8.4 sends an extra 0x01 byte at the beginning of ext-salt; cf. https://mariadb.com/docs/server/reference/clientserver-protocol/1-connecting/connection#parsec-plugin
949-
if (extendedSalt.Length == 21 && extendedSalt[0] == 1 && extendedSalt[1] == 'P')
948+
// MariaDB 11.8.4 sends an extra 0x01 byte at the beginning of ext-salt: https://github.com/mysql-net/MySqlConnector/issues/1606
949+
if (extendedSalt.Length > 2 && extendedSalt[0] == 1 && extendedSalt[1] == 'P')
950950
extendedSalt = extendedSalt[1..];
951951

952952
Span<byte> combinedData = stackalloc byte[switchRequest.Data.Length + extendedSalt.Length];

0 commit comments

Comments
 (0)