MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Chad MILLER Date:June 8 2007 8:10pm
Subject:bk commit into 4.1 tree (cmiller:1.2654) BUG#28984
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of cmiller. When cmiller does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-08 16:10:53-04:00, cmiller@stripped +1 -0
  Bug #28984: crasher on connect with out of range password length in \
  	protocol
  
  One could send a malformed packet that caused the server to SEGV.  In 
  recent versions of the password protocol, the client tells the server 
  what length the ciphertext is (almost always 20).  If that length was
  large enough to overflow a signed char, then the number would jump to 
  very large after being casted to unsigned int.
  
  Instead, cast the *passwd char to uchar. 
  

  sql/sql_parse.cc@stripped, 2007-06-08 16:10:51-04:00, cmiller@stripped +4 -1
    Cast *passwd to get rid of the sign, so that sign extension doesn't
    cause the sequence 125, 126, 127, 4294967169, 4294967170.
    

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	cmiller
# Host:	zippy.cornsilk.net
# Root:	/home/cmiller/work/mysql/41gca

--- 1.497/sql/sql_parse.cc	2007-04-17 07:52:49 -04:00
+++ 1.498/sql/sql_parse.cc	2007-06-08 16:10:51 -04:00
@@ -909,9 +909,12 @@ static int check_connection(THD *thd)
     Old clients send null-terminated string as password; new clients send
     the size (1 byte) + string (not null-terminated). Hence in case of empty
     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 ?
-    *passwd++ : strlen(passwd);
+    (uchar)(*passwd++) : strlen(passwd);
   db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
     db + passwd_len + 1 : 0;
   uint db_len= db ? strlen(db) : 0;
Thread
bk commit into 4.1 tree (cmiller:1.2654) BUG#28984Chad MILLER8 Jun