This is an automated email from the ASF dual-hosted git repository.

zykkk pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new ba1d8fe30ac [fix](mysql) Fix Connection Attributes Parsing Logic for 
Compatibility (#32177) (#32302)
ba1d8fe30ac is described below

commit ba1d8fe30ac6f5191ac585b96c9dc11ee0317f03
Author: zy-kkk <[email protected]>
AuthorDate: Sat Mar 16 15:02:26 2024 +0800

    [fix](mysql) Fix Connection Attributes Parsing Logic for Compatibility 
(#32177) (#32302)
---
 fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlAuthPacket.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlAuthPacket.java 
b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlAuthPacket.java
index b112850b393..cf196f82be1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlAuthPacket.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlAuthPacket.java
@@ -104,8 +104,9 @@ public class MysqlAuthPacket extends MysqlPacket {
         // attribute map, no use now.
         if (buffer.remaining() > 0 && capability.isConnectAttrs()) {
             connectAttributes = Maps.newHashMap();
-            long numPair = MysqlProto.readVInt(buffer);
-            for (long i = 0; i < numPair; ++i) {
+            long attrsLength = MysqlProto.readVInt(buffer);
+            long initialPosition = buffer.position();
+            while (buffer.position() - initialPosition < attrsLength) {
                 String key = new 
String(MysqlProto.readLenEncodedString(buffer));
                 String value = new 
String(MysqlProto.readLenEncodedString(buffer));
                 connectAttributes.put(key, value);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to