From e0d1cc5c2ca2e57e945ff257d0637b6884912313 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Fri, 17 Mar 2000 10:31:37 +0000 Subject: [PATCH] Changes from A. Samoilov --- ChangeLog | 4 ++++ gtkedit/editmenu.c | 6 +++--- gtkedit/editoptions.c | 2 -- gtkedit/syntax.c | 8 ++++---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index f92e51294..079684a18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ + * gtkedit/syntax.c (upgrade_syntax_file): possible buffer overflow + fixed, some messages gettext()ed again here and in + gtkedit/editmenu.c:edit_about_cmd() + 2000-03-13 Pavel Machek * doc/mc.sgml (Examples): Fixed documentation, thanx diff --git a/gtkedit/editmenu.c b/gtkedit/editmenu.c index ba01d85d3..9bab49d7b 100644 --- a/gtkedit/editmenu.c +++ b/gtkedit/editmenu.c @@ -71,14 +71,14 @@ void edit_wrap_cmd () void edit_about_cmd () { - edit_message_dialog (wedit->mainid, 20, 20, " About ", - "\n" + edit_message_dialog (wedit->mainid, 20, 20, _(" About "), + _("\n" " Cooledit v3.11.5\n" "\n" " Copyright (C) 1996 the Free Software Foundation\n" "\n" " A user friendly text editor written\n" - " for the Midnight Commander.\n" + " for the Midnight Commander.\n") ); } diff --git a/gtkedit/editoptions.c b/gtkedit/editoptions.c index 143c7c03d..dfc2ffc74 100644 --- a/gtkedit/editoptions.c +++ b/gtkedit/editoptions.c @@ -42,8 +42,6 @@ extern int option_syntax_highlighting; void i18n_translate_array (char *array[]) { - size_t maxlen = 0; - while (*array!=NULL) { *array = _(*array); array++; diff --git a/gtkedit/syntax.c b/gtkedit/syntax.c index 52f3b2483..289b36365 100644 --- a/gtkedit/syntax.c +++ b/gtkedit/syntax.c @@ -1352,8 +1352,8 @@ FILE *upgrade_syntax_file (char *syntax_file) fclose (f); return fopen (syntax_file, "r"); } - memset (line, 0, 79); - fread (line, 80, 1, f); + memset (line, 0, sizeof (line)); + fread (line, sizeof (line) - 1, 1, f); if (!strstr (line, "syntax rules version")) goto rename_rule_file; p = strstr (line, "version") + strlen ("version") + 1; @@ -1366,9 +1366,9 @@ FILE *upgrade_syntax_file (char *syntax_file) rename (syntax_file, s); unlink (syntax_file); /* might rename() fail ? */ #if defined(MIDNIGHT) || defined(GTK) - edit_message_dialog (" Load Syntax Rules ", " Your syntax rule file is outdated \n A new rule file is being installed. \n Your old rule file has been saved with a .OLD extension. "); + edit_message_dialog (_(" Load Syntax Rules "), _(" Your syntax rule file is outdated \n A new rule file is being installed. \n Your old rule file has been saved with a .OLD extension. ")); #else - CMessageDialog (0, 20, 20, 0, " Load Syntax Rules ", " Your syntax rule file is outdated \n A new rule file is being installed. \n Your old rule file has been saved with a .OLD extension. "); + CMessageDialog (0, 20, 20, 0,_(" Load Syntax Rules "), _(" Your syntax rule file is outdated \n A new rule file is being installed. \n Your old rule file has been saved with a .OLD extension. ")); #endif return upgrade_syntax_file (syntax_file); }