• Alexander Barkov's avatar
    Bug#11765108 (Bug#58036) client utf32, utf16, ucs2 should be disallowed, they crash server · f4beb929
    Alexander Barkov authored
    Problem: ucs2 was correctly disallowed in "SET NAMES" only,
    while mysql_real_connect() and mysql_change_user() still allowed
    to use ucs2, which made server crash.
    
    Fix: disallow ucs2 in mysql_real_connect() and mysql_change_user().
    
      @ sql/set_var.cc
        Using new function.
    
      @ sql/sql_acl.cc
        - Return error if character set initialization failed
        - Getting rid of pointer aliasing:
          Initialize user_name to NULL, to avoid double free().
    
      @ sql/sql_connect.cc
        - in case of unsupported client character set send error and return true
        - in case of success return false
    
      @ sql/sql_connect.h
        - changing return type for thd_init_client_charset() to bool,
          to return errors to the caller
    
      @ sql/sql_parse.h
        - introducing a new function, to reuse in all places where we need
        to check client character set.
    
      @ tests/mysql_client_test.c
        Adding test
    f4beb929
mysql_client_test.c 533 KB