* editcmd.c (edit_replace_cmd): Eliminate fin_string

and use message() to fix possible buffer overflow.
(edit_search_cmd): Likewise.
This commit is contained in:
Andrew V. Samoilov 2002-02-27 15:40:22 +00:00
parent 0924daa8f5
commit 80fb518808
2 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2002-02-27 Andrew V. Samoilov <kai@cmail.ru>
* editcmd.c (edit_replace_cmd): Eliminate fin_string
and use message() to fix possible buffer overflow.
(edit_search_cmd): Likewise.
2002-02-18 Andrew V. Samoilov <kai@cmail.ru> 2002-02-18 Andrew V. Samoilov <kai@cmail.ru>
* syntax.c (convert): Fix buffer overflow for ".*\" cases. * syntax.c (convert): Fix buffer overflow for ".*\" cases.

View File

@ -1587,7 +1587,6 @@ void edit_replace_cmd (WEdit * edit, int again)
int treplace_prompt = 0; int treplace_prompt = 0;
int i = 0; int i = 0;
long times_replaced = 0, last_search; long times_replaced = 0, last_search;
char fin_string[64];
int argord[NUM_REPL_ARGS]; int argord[NUM_REPL_ARGS];
if (!edit) { if (!edit) {
@ -1797,8 +1796,7 @@ void edit_replace_cmd (WEdit * edit, int again)
edit->force |= REDRAW_PAGE; edit->force |= REDRAW_PAGE;
edit_render_keypress (edit); edit_render_keypress (edit);
if (times_replaced) { if (times_replaced) {
sprintf (fin_string, _ (" %ld replacements made. "), times_replaced); message (0, _(" Replace "), _(" %ld replacements made. "), times_replaced);
edit_message_dialog (_ (" Replace "), fin_string);
} else } else
edit_message_dialog (_ (" Replace "), _ (" Search string not found. ")); edit_message_dialog (_ (" Replace "), _ (" Search string not found. "));
replace_continue = 0; replace_continue = 0;
@ -1875,10 +1873,8 @@ void edit_search_cmd (WEdit * edit, int again)
q = p + 1; q = p + 1;
} }
if (found) { if (found) {
char fin_string[64];
/* in response to number of bookmarks added because of string being found %d times */ /* in response to number of bookmarks added because of string being found %d times */
sprintf (fin_string, _ (" %d finds made, %d bookmarks added "), found, books); message (0, _(" Search "), _(" %d finds made, %d bookmarks added "), found, books);
edit_message_dialog (_ (" Search "), fin_string);
} else { } else {
edit_error_dialog (_ (" Search "), _ (" Search string not found. ")); edit_error_dialog (_ (" Search "), _ (" Search string not found. "));
} }