Commit 7887a52d authored by Tatiana A. Nurnberg's avatar Tatiana A. Nurnberg

Bug#35480: BOM detection code crashes mysql CLI with zero-sized input

MySQL client crashed if no input was passed to it.

client/mysql.cc:
  Check if there's any data before reading it!
parent f13393db
...@@ -1821,7 +1821,7 @@ static int read_and_execute(bool interactive) ...@@ -1821,7 +1821,7 @@ static int read_and_execute(bool interactive)
the very beginning of a text file when the very beginning of a text file when
you save the file using "Unicode UTF-8" format. you save the file using "Unicode UTF-8" format.
*/ */
if (!line_number && if (line && !line_number &&
(uchar) line[0] == 0xEF && (uchar) line[0] == 0xEF &&
(uchar) line[1] == 0xBB && (uchar) line[1] == 0xBB &&
(uchar) line[2] == 0xBF) (uchar) line[2] == 0xBF)
......
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