Bug #2703 MySQL server does not detect if garbage chars at the end of query
Submitted: 11 Feb 2004 3:14 Modified: 11 Feb 2004 3:35
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Any (all)
Assigned to: Guilhem Bichot

[11 Feb 2004 3:14] Guilhem Bichot
Description:
Doing
mysql_real_query(mysql, "create database test10\000\001", 24);
(24 is the length including the two last non-printable characters);
the MySQL server does not complain, executes successfully the query (creates the database test10) and writes to the binlog:
create database test10^@^A;

Same issue with mysql_prepare().

How to repeat:
see description; or take a look at the binlog produced by tests/client_test.c.

Suggested fix:
The parser apparently stops parsing at \000, as it is satisfied with what it has parsed at that point. The MySQL server should check that nothing remains. Pushing a fix as discussed with CTO.
[11 Feb 2004 3:35] Guilhem Bichot
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Fixed in 4.1 in ChangeSet@1.1714.1.1, 2004-02-11 12:32:47+01:00, guilhem@gbichot2.local