Commit b6bd61d4 authored by tsmith@maint1.mysql.com's avatar tsmith@maint1.mysql.com

Merge maint1.mysql.com:/data/localhome/tsmith/bk/41

into  maint1.mysql.com:/data/localhome/tsmith/bk/maint/41
parents 52200be6 4c9af559
...@@ -90,6 +90,16 @@ extern char* tgoto(const char*, int, int); ...@@ -90,6 +90,16 @@ extern char* tgoto(const char*, int, int);
extern char* tgetstr(char*, char**); extern char* tgetstr(char*, char**);
#endif #endif
#if !HAVE_DECL_TGOTO
/*
'tgoto' is not declared in the system header files, this causes
problems on 64-bit systems. The function returns a 64 bit pointer
but caller see it as "int" and it's thus truncated to 32-bit
*/
extern char* tgoto(const char*, int, int);
#endif
protected void term_move_to_line(EditLine *, int); protected void term_move_to_line(EditLine *, int);
protected void term_move_to_char(EditLine *, int); protected void term_move_to_char(EditLine *, int);
protected void term_clear_EOL(EditLine *, int); protected void term_clear_EOL(EditLine *, int);
......
...@@ -1960,6 +1960,19 @@ else ...@@ -1960,6 +1960,19 @@ else
fi fi
AC_SUBST(TERMCAP_LIB) AC_SUBST(TERMCAP_LIB)
# Check if the termcap function 'tgoto' is already declared in
# system header files or if it need to be declared locally
AC_CHECK_DECLS(tgoto,,,[
#ifdef HAVE_CURSES_H
# include <curses.h>
#elif HAVE_NCURSES_H
# include <ncurses.h>
#endif
#ifdef HAVE_TERM_H
# include <term.h>
#endif
])
LIBEDIT_LOBJECTS="" LIBEDIT_LOBJECTS=""
AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"]) AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"]) AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
......
...@@ -909,9 +909,12 @@ static int check_connection(THD *thd) ...@@ -909,9 +909,12 @@ static int check_connection(THD *thd)
Old clients send null-terminated string as password; new clients send Old clients send null-terminated string as password; new clients send
the size (1 byte) + string (not null-terminated). Hence in case of empty the size (1 byte) + string (not null-terminated). Hence in case of empty
password both send '\0'. password both send '\0'.
Cast *passwd to an unsigned char, so that it doesn't extend the sign for
*passwd > 127 and become 2**32-127 after casting to uint.
*/ */
uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
*passwd++ : strlen(passwd); (uchar)(*passwd++) : strlen(passwd);
db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ? db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
db + passwd_len + 1 : 0; db + passwd_len + 1 : 0;
uint db_len= db ? strlen(db) : 0; uint db_len= db ? strlen(db) : 0;
...@@ -1442,11 +1445,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1442,11 +1445,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
Old clients send null-terminated string ('\0' for empty string) for Old clients send null-terminated string ('\0' for empty string) for
password. New clients send the size (1 byte) + string (not null password. New clients send the size (1 byte) + string (not null
terminated, so also '\0' for empty string). terminated, so also '\0' for empty string).
Cast *passwd to an unsigned char, so that it doesn't extend the sign
for *passwd > 127 and become 2**32-127 after casting to uint.
*/ */
char db_buff[NAME_LEN+1]; // buffer to store db in utf8 char db_buff[NAME_LEN+1]; // buffer to store db in utf8
char *db= passwd; char *db= passwd;
uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
*passwd++ : strlen(passwd); (uchar)(*passwd++) : strlen(passwd);
db+= passwd_len + 1; db+= passwd_len + 1;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
/* Small check for incomming packet */ /* Small check for incomming packet */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment