From 35511309899bed0efe3efb1ab073272e5d5e4974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 8 Aug 2018 07:04:27 +0200 Subject: [PATCH] Ensure that the scramble sent during handshake has always positive char #1636 This seems a problem only with MySQL Connector/J 8.0 , but it is possible that other drivers could be affected --- lib/MySQL_Protocol.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index 586b068ece..3ca69f2de5 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -81,6 +81,13 @@ void proxy_create_random_string(char *to, uint length, struct rand_struct *rand_ } } else { for (i=0; imyconn->scramble_buff[i]==0) { - (*myds)->myconn->scramble_buff[i]='a'; - } - } + +// for (i=0;i<8;i++) { +// if ((*myds)->myconn->scramble_buff[i]==0) { +// (*myds)->myconn->scramble_buff[i]='a'; +// } +// } memcpy(_ptr+l, (*myds)->myconn->scramble_buff+0, 8); l+=8; _ptr[l]=0x00; l+=1; //0x00 @@ -1093,11 +1101,11 @@ bool MySQL_Protocol::generate_pkt_initial_handshake(bool send, void **ptr, unsig //#endif //create_random_string(scramble_buf+8,12,&rand_st); - for (i=8;i<20;i++) { - if ((*myds)->myconn->scramble_buff[i]==0) { - (*myds)->myconn->scramble_buff[i]='a'; - } - } +// for (i=8;i<20;i++) { +// if ((*myds)->myconn->scramble_buff[i]==0) { +// (*myds)->myconn->scramble_buff[i]='a'; +// } +// } memcpy(_ptr+l, (*myds)->myconn->scramble_buff+8, 12); l+=12; l+=1; //0x00