• guilhem@gbichot2.local's avatar
    Fix for BUG#2703 · e450acc7
    guilhem@gbichot2.local authored
    "MySQL server does not detect if garbage chars at the end of query":
    
    Detect garbage chars at the end of the query or at the end of a query
    for a prepared statement (which happens if mysql_real_query() or mysql_prepare()
    were called with a too big 'length' parameter (bigger than the real intended
    length of the query: then we receive a query + garbage characters from the
    client). This resulted in garbage chars written into the binlog.
    Now instead the client receives something like:
    'You have an error in your SQL syntax.  Check the manual that corresponds
    to your MySQL server version for the right syntax to use near '!stmt'
    at line 1' i.e. the server is pointing at the weird tail of the query
    (this '!stmt' are the garbage chars sent by the client).
    All tests pass, except mysqldump.test and ctype_utf8.test but they failed
    before the patch.
    e450acc7
sql_prepare.cc 32 KB