Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e4cb7947
Commit
e4cb7947
authored
Jun 09, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix use of _cgets() to handle an input line that exceeds our buffer space
before a newline is found. (Bug #10840)
parent
9ba4a6c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
client/mysql.cc
client/mysql.cc
+20
-1
No files found.
client/mysql.cc
View file @
e4cb7947
...
...
@@ -931,6 +931,7 @@ static int read_lines(bool execute_commands)
{
#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
char
linebuffer
[
254
];
String
buffer
;
#endif
char
*
line
;
char
in_string
=
0
;
...
...
@@ -972,9 +973,24 @@ static int read_lines(bool execute_commands)
*
p
=
'\0'
;
}
#else
buffer
.
length
(
0
);
/* _cgets() expects the buffer size - 3 as the first byte */
linebuffer
[
0
]
=
(
char
)
sizeof
(
linebuffer
)
-
3
;
line
=
_cgets
(
linebuffer
);
do
{
line
=
_cgets
(
linebuffer
);
buffer
.
append
(
line
,
(
unsigned
char
)
linebuffer
[
1
]);
/*
If _cgets() gets an input line that is linebuffer[0] bytes
long, the next call to _cgets() will return immediately with
linebuffer[1] == 0, and it does the same thing for input that
is linebuffer[0]-1 bytes long. So it appears that even though
_cgets() replaces the newline (which is two bytes on Window) with
a nil, it still needs the space in the linebuffer for it. This is,
naturally, undocumented.
*/
}
while
(
linebuffer
[
0
]
<=
linebuffer
[
1
]
+
1
);
line
=
buffer
.
c_ptr
();
#endif
/* __NETWARE__ */
#else
if
(
opt_outfile
)
...
...
@@ -1031,6 +1047,9 @@ static int read_lines(bool execute_commands)
status
.
exit_status
=
0
;
}
}
#if defined( __WIN__) || defined(OS2) || defined(__NETWARE__)
buffer
.
free
();
#endif
return
status
.
exit_status
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment