mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 23:35:20 +00:00
fix to read just 20 bytes for AuthSwitchRequest data
This commit is contained in:
parent
fd0101afb2
commit
043bbd5a84
@ -25,7 +25,16 @@ impl Decode<'_> for AuthSwitchRequest {
|
||||
}
|
||||
|
||||
let plugin = buf.get_str_nul()?.parse()?;
|
||||
let data = buf.get_bytes(buf.len());
|
||||
|
||||
// See: https://github.com/mysql/mysql-server/blob/ea7d2e2d16ac03afdd9cb72a972a95981107bf51/sql/auth/sha2_password.cc#L942
|
||||
if buf.len() != 21 {
|
||||
return Err(err_protocol!(
|
||||
"expected 21 bytes but found {} bytes",
|
||||
buf.len()
|
||||
));
|
||||
}
|
||||
let data = buf.get_bytes(20);
|
||||
buf.advance(1); // NUL-terminator
|
||||
|
||||
Ok(Self { plugin, data })
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user