Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.7.11
-
None
-
MariaDB Java Connector 2.X
Description
MariaDB Java Connecter 2.X may generate wrong sequence number for the sub header.
It can be reproduced by the following code:
import java.sql.*; |
|
public class Main { |
public static void main(String[] args) { |
String url = "jdbc:mariadb://127.0.0.1:4000/test?useCompression=True"; |
String user = "root"; |
String password = ""; |
|
try { |
Connection c = DriverManager.getConnection(url, user, password);
|
|
Statement s = c.createStatement();
|
|
String sql = "-- :: userIDaebcda5cb52dc741f20fe495327ddbfc8411cc53663eec3a5ffdb1f30626d39cc606822\nselect version();"; |
s.execute(sql);
|
s.close();
|
c.close();
|
|
} catch (SQLException e) { |
e.printStackTrace();
|
}
|
|
}
|
}
|
For version 2.X, it produces the following packet with sub header: 66 00 00 01
And for version 3.X, the sub header looks like: 66 00 00 00
The sequence number of sub header should be 0 in fact. Fortunately, MySQL / MariaDB don't take this number seriously and just skip the check process. Thus it can work as normal.
However, for some other databases that follow MySQL protocol with a stricter sequence check, this would cause a problem.