Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix generating authentication response with long strings
Connection attributes shall be encoded using lenenc-str
approach for a separate string and the whole section.
  • Loading branch information
netch80 committed Jun 27, 2021
commit f1c5013cb27477cd7cda853ebbd6c88806e8a230
6 changes: 3 additions & 3 deletions pymysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,10 +898,10 @@ def _request_authentication(self):
connect_attrs = b""
for k, v in self._connect_attrs.items():
k = k.encode("utf-8")
connect_attrs += struct.pack("B", len(k)) + k
connect_attrs += _lenenc_int(len(k)) + k
v = v.encode("utf-8")
connect_attrs += struct.pack("B", len(v)) + v
data += struct.pack("B", len(connect_attrs)) + connect_attrs
connect_attrs += _lenenc_int(len(v)) + v
data += _lenenc_int(len(connect_attrs)) + connect_attrs

self.write_packet(data)
auth_packet = self._read_packet()
Expand Down