Merge lp:~mordred/drizzle/bug405501 into lp:~drizzle-trunk/drizzle/development

Proposed by Monty Taylor
Status: Merged
Approved by: Jay Pipes
Approved revision: 1127
Merged at revision: not available
Proposed branch: lp:~mordred/drizzle/bug405501
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~mordred/drizzle/bug405501
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+11719@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Monty Taylor (mordred) wrote :

Fixed a buffer overrun.

Revision history for this message
Jay Pipes (jaypipes) wrote :

Merging into a captain branch with Trond's bug fix for 416554, since Diego's bug fixes have a little issue right now...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/drizzle.cc'
2--- client/drizzle.cc 2009-07-20 18:10:47 +0000
3+++ client/drizzle.cc 2009-08-29 19:30:29 +0000
4@@ -1144,8 +1144,6 @@
5
6 int main(int argc,char *argv[])
7 {
8- char buff[80];
9-
10 #if defined(ENABLE_NLS)
11 # if defined(HAVE_LOCALE_H)
12 setlocale(LC_ALL, "");
13@@ -1317,10 +1315,9 @@
14 sprintf(histfile_tmp, "%s.TMP", histfile);
15 }
16 }
17- sprintf(buff, "%s",
18- _("Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"));
19
20- put_info(buff,INFO_INFO,0,0);
21+ put_info(_("Type 'help;' or '\\h' for help. "
22+ "Type '\\c' to clear the buffer.\n"),INFO_INFO,0,0);
23 status.exit_status= read_and_execute(!status.batch);
24 if (opt_outfile)
25 end_tee();
26@@ -1986,7 +1983,7 @@
27 bool *ml_comment)
28 {
29 unsigned char inchar;
30- char buff[80], *pos, *out;
31+ char *pos, *out;
32 COMMANDS *com;
33 bool need_space= 0;
34 bool ss_comment= 0;
35@@ -2076,8 +2073,12 @@
36 }
37 else
38 {
39- sprintf(buff,_("Unknown command '\\%c'."),inchar);
40- if (put_info(buff,INFO_ERROR,0,0) > 0)
41+ string buff(_("Unknown command: "));
42+ buff.push_back('\'');
43+ buff.push_back(inchar);
44+ buff.push_back('\'');
45+ buff.push_back('.');
46+ if (put_info(buff.c_str(),INFO_ERROR,0,0) > 0)
47 return(1);
48 *out++='\\';
49 *out++=(char) inchar;