• Alexander Barkov's avatar
    Bug#11765108 (Bug#58036) client utf32, utf16, ucs2 should be disallowed, they crash server · 8a960129
    Alexander Barkov authored
    A separate fix for 5.1 (as 5.1 and 5.5 have seriously
    differged in the related pieces of the code).
    A patch for 5.5 was approved earlier.
    
    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/sql_priv.h
        - changing return type for thd_init_client_charset() to bool,
          to return errors to the caller
    
      @ sql/sql_var.cc
        - using new function
    
      @ sql/sql_connect.cc
        - thd_client_charset_init:
          in case of unsupported client character set send error and return true;
          in case of success return false
        - check_connection:
          Return error if character set initialization failed
    
      @ sql/sql_parse.cc
        - check charset in the very beginnig of the CMD_CHANGE_USER handling code
    
      @ tests/mysql_client_test.c
        - adding tests
    8a960129
set_var.cc 133 KB