Commit c187840b authored by Vamsikrishna Bhagi's avatar Vamsikrishna Bhagi

Bug #18186103 BUFFER OVERFLOW IN CLIENT

Problem: While printing the Server version, mysql client
         doesn't check for the buffer overflow in a
         String variable.

Solution: Used a different print function which checks the
          allocated length before writing into the string.
parent a3123b84
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -1176,9 +1176,9 @@ int main(int argc,char *argv[]) ...@@ -1176,9 +1176,9 @@ int main(int argc,char *argv[])
put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.", put_info("Welcome to the MySQL monitor. Commands end with ; or \\g.",
INFO_INFO); INFO_INFO);
sprintf((char*) glob_buffer.ptr(), snprintf((char*) glob_buffer.ptr(), glob_buffer.alloced_length(),
"Your MySQL connection id is %lu\nServer version: %s\n", "Your MySQL connection id is %lu\nServer version: %s\n",
mysql_thread_id(&mysql), server_version_string(&mysql)); mysql_thread_id(&mysql), server_version_string(&mysql));
put_info((char*) glob_buffer.ptr(),INFO_INFO); put_info((char*) glob_buffer.ptr(),INFO_INFO);
put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO); put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000"), INFO_INFO);
......
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