Bug #46001 Improve error packet protocol code with respect to sqlstate
Submitted: 7 Jul 2009 11:00
Reporter: Kay Roepke Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Proxy: Core Severity:S4 (Feature request)
Version:0.7, 0.8 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[7 Jul 2009 11:00] Kay Roepke
Description:
In network_mysqld_con_send_error_full the length of the sqlstate string, but network_mysqld_proto_append_err_packet will assume that string to be always 5 characters in length.

How to repeat:
n/a

Suggested fix:
Either pad the sqlstate with leading zero characters and note that in the return value of network_mysqld_proto_append_err_packet or explicitely check for sqlstate being of the right length and return an error if that is not satisfied.
Even better would be to change the function signatures to make use of GErrors to convey error conditions back to the caller, that would also get rid of a number of critical warnings in that area of the code.