Skip to content

Commit a198e80

Browse files
committed
Limit client flags to server capabilities
1 parent d94bfaa commit a198e80

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/commands/server_handshake.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ServerHandshake extends Command {
3535

3636
readClientReply(packet, connection) {
3737
// check auth here
38-
const clientHelloReply = Packets.HandshakeResponse.fromPacket(packet);
38+
const clientHelloReply = Packets.HandshakeResponse.fromPacket(packet, this.args.capabilityFlags);
3939
// TODO check we don't have something similar already
4040
connection.clientHelloReply = clientHelloReply;
4141
if (this.args.authCallback) {

lib/packets/handshake_response.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ class HandshakeResponse {
9999
const p = this.serializeResponse(Packet.MockBuffer());
100100
return this.serializeResponse(Buffer.alloc(p.offset));
101101
}
102-
static fromPacket(packet) {
102+
static fromPacket(packet, serverFlags) {
103103
const args = {};
104104
args.clientFlags = packet.readInt32();
105105
function isSet(flag) {
106-
return args.clientFlags & ClientConstants[flag];
106+
return (args.clientFlags & serverFlags) & ClientConstants[flag];
107107
}
108108
args.maxPacketSize = packet.readInt32();
109109
args.charsetNumber = packet.readInt8();

0 commit comments

Comments
 (0)