From 2fd9699ebf368cda67725b7057c92a12d5372279 Mon Sep 17 00:00:00 2001 From: Melvin Hadasht Date: Sat, 13 Jul 2002 11:20:49 +0000 Subject: [PATCH] * src/addrbook.c * src/addressbook.c * src/addrindex.c Replaced sprintf by g_snprintf to prevent possible buffer overflow. * src/news.c Corrected a log message output format. Added a missing "done" debug output. * src/compose.c Added keyboard accelerator for Priority menu items Added missing \n in debug output * src/logwindow.c * src/gtkspell.c * src/rfc2015.c Added missing \n in debug output --- ChangeLog.claws | 20 +++++++++++++++++++- configure.in | 2 +- src/addrbook.c | 4 ++-- src/addressbook.c | 27 +++++++++++++++++++-------- src/addrindex.c | 3 ++- src/compose.c | 14 +++++++------- src/gtkspell.c | 2 +- src/logwindow.c | 4 ++-- src/news.c | 3 ++- src/rfc2015.c | 10 +++++----- 10 files changed, 60 insertions(+), 29 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index 6e72d8e7c..a04f475df 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,21 @@ +2002-07-09 [melvin] 0.7.8claws65 + + * src/addrbook.c + * src/addressbook.c + * src/addrindex.c + Replaced sprintf by g_snprintf to prevent possible buffer + overflow. + * src/news.c + Corrected a log message output format. + Added a missing "done" debug output. + * src/compose.c + Added keyboard accelerator for Priority menu items + Added missing \n in debug output + * src/logwindow.c + * src/gtkspell.c + * src/rfc2015.c + Added missing \n in debug output + 2002-07-13 [paul] 0.7.8claws64 * man/sylpheed.1 @@ -78,7 +96,7 @@ changed calls from gtk_ctree_sort_recursive() and gtk_ctree_sort_node() to gtk_sctree_sort_recursive() and gtk_sctree_sort_node() -2002-07-08 [paul] 0.7.8claws55 +2002-07-08 [paul] 0.7.8claws55 * more sync with 0.7.8cvs21 see ChangeLog 2002-07-08 diff --git a/configure.in b/configure.in index 897fab05b..c9a9dfab0 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ MINOR_VERSION=7 MICRO_VERSION=8 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws64 +EXTRA_VERSION=claws65 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/addrbook.c b/src/addrbook.c index dcdad5c7b..b51ad9017 100644 --- a/src/addrbook.c +++ b/src/addrbook.c @@ -1709,8 +1709,8 @@ gchar *addrbook_gen_new_file_name( gint fileNum ) { if( n < 1 ) n = 1; nmax = -1 + (long int) pow( 10, FILE_NUMDIGITS ); if( fileNum > nmax ) return NULL; - sprintf( fmt, "%%s%%0%dd%%s", FILE_NUMDIGITS ); - sprintf( buf, fmt, ADDRBOOK_PREFIX, n, ADDRBOOK_SUFFIX ); + g_snprintf( fmt, sizeof(fmt), "%%s%%0%dd%%s", FILE_NUMDIGITS ); + g_snprintf( buf, sizeof(buf), fmt, ADDRBOOK_PREFIX, n, ADDRBOOK_SUFFIX ); return g_strdup( buf ); } diff --git a/src/addressbook.c b/src/addressbook.c index bb1073088..e894a0010 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -803,10 +803,12 @@ static void addressbook_ds_status_message( AddressDataSource *ds, gchar *msg ) { gchar *name; name = addrindex_ds_get_name( ds ); - sprintf( addressbook_msgbuf, "%s: %s", name, msg ); + g_snprintf( addressbook_msgbuf, sizeof(addressbook_msgbuf), + "%s: %s", name, msg ); } else { - sprintf( addressbook_msgbuf, "%s", msg ); + g_snprintf( addressbook_msgbuf, sizeof(addressbook_msgbuf), + "%s", msg ); } addressbook_status_show( addressbook_msgbuf ); } @@ -819,11 +821,13 @@ static void addressbook_ds_show_message( AddressDataSource *ds ) { name = addrindex_ds_get_name( ds ); retVal = addrindex_ds_get_status_code( ds ); if( retVal == MGU_SUCCESS ) { - sprintf( addressbook_msgbuf, "%s", name ); + g_snprintf( addressbook_msgbuf, + sizeof(addressbook_msgbuf), "%s", name ); } else { - sprintf( addressbook_msgbuf, "%s: %s", name, - mgu_error2string( retVal ) ); + g_snprintf( addressbook_msgbuf, + sizeof(addressbook_msgbuf), "%s: %s", name, + mgu_error2string( retVal ) ); } } addressbook_status_show( addressbook_msgbuf ); @@ -3182,14 +3186,21 @@ static void addressbook_ldap_show_message( SyldapServer *svr ) { if( svr ) { name = syldap_get_name( svr ); if( svr->busyFlag ) { - sprintf( addressbook_msgbuf, "%s: %s", name, ADDRESSBOOK_LDAP_BUSYMSG ); + g_snprintf( addressbook_msgbuf, + sizeof(addressbook_msgbuf), "%s: %s", name, + ADDRESSBOOK_LDAP_BUSYMSG ); } else { if( svr->retVal == MGU_SUCCESS ) { - sprintf( addressbook_msgbuf, "%s", name ); + g_snprintf( addressbook_msgbuf, + sizeof(addressbook_msgbuf), "%s", + name ); } else { - sprintf( addressbook_msgbuf, "%s: %s", name, mgu_error2string( svr->retVal ) ); + g_snprintf( addressbook_msgbuf, + sizeof(addressbook_msgbuf), + "%s: %s", name, + mgu_error2string( svr->retVal ) ); } } } diff --git a/src/addrindex.c b/src/addrindex.c index 0dbc3edc7..141c5141e 100644 --- a/src/addrindex.c +++ b/src/addrindex.c @@ -907,7 +907,8 @@ static void addrindex_write_jpilot( FILE *fp,AddressDataSource *ds, gint lvl ) { ind = 1; while( node ) { gchar name[256]; - sprintf( name, "%s%d", ATTAG_JPILOT_CUSTOM, ind ); + g_snprintf( name, sizeof(name), "%s%d", + ATTAG_JPILOT_CUSTOM, ind ); addrindex_write_attr( fp, name, node->data ); ind++; node = g_list_next( node ); diff --git a/src/compose.c b/src/compose.c index fd686887c..4af936012 100644 --- a/src/compose.c +++ b/src/compose.c @@ -650,12 +650,12 @@ static GtkItemFactoryEntry compose_entries[] = {N_("/_Message/_Encrypt"), NULL, compose_toggle_encrypt_cb, 0, ""}, #endif /* USE_GPGME */ {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/Priority"), NULL, NULL, 0, ""}, - {N_("/_Message/Priority/Highest"), NULL, compose_set_priority_cb, PRIORITY_HIGHEST, ""}, - {N_("/_Message/Priority/High"), NULL, compose_set_priority_cb, PRIORITY_HIGH, "/Message/Priority/Highest"}, - {N_("/_Message/Priority/Normal"), NULL, compose_set_priority_cb, PRIORITY_NORMAL, "/Message/Priority/Highest"}, - {N_("/_Message/Priority/Low"), NULL, compose_set_priority_cb, PRIORITY_LOW, "/Message/Priority/Highest"}, - {N_("/_Message/Priority/Lowest"), NULL, compose_set_priority_cb, PRIORITY_LOWEST, "/Message/Priority/Highest"}, + {N_("/_Message/_Priority"), NULL, NULL, 0, ""}, + {N_("/_Message/Priority/_Highest"), NULL, compose_set_priority_cb, PRIORITY_HIGHEST, ""}, + {N_("/_Message/Priority/Hi_gh"), NULL, compose_set_priority_cb, PRIORITY_HIGH, "/Message/Priority/Highest"}, + {N_("/_Message/Priority/_Normal"), NULL, compose_set_priority_cb, PRIORITY_NORMAL, "/Message/Priority/Highest"}, + {N_("/_Message/Priority/Lo_w"), NULL, compose_set_priority_cb, PRIORITY_LOW, "/Message/Priority/Highest"}, + {N_("/_Message/Priority/_Lowest"), NULL, compose_set_priority_cb, PRIORITY_LOWEST, "/Message/Priority/Highest"}, {N_("/_Message/---"), NULL, NULL, 0, ""}, {N_("/_Message/_Request Return Receipt"), NULL, compose_toggle_return_receipt_cb, 0, ""}, {N_("/_Tools"), NULL, NULL, 0, ""}, @@ -4663,7 +4663,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode) GtkWidget *menuitem; if (!gtkpspell_set_sug_mode(gtkpspell, prefs_common.pspell_sugmode)) { - debug_print(_("Pspell: could not set suggestion mode %s"), + debug_print(_("Pspell: could not set suggestion mode %s\n"), gtkpspellcheckers->error_message); gtkpspell_checkers_reset_error(); } diff --git a/src/gtkspell.c b/src/gtkspell.c index 3df1acfa8..7b9f17efb 100644 --- a/src/gtkspell.c +++ b/src/gtkspell.c @@ -1543,7 +1543,7 @@ GSList *gtkpspell_get_dictionary_list(const gchar *pspell_path, gint refresh) } if(list==NULL){ - debug_print(_("Pspell: error when searching for dictionaries.\nNo dictionary found.")); + debug_print(_("Pspell: error when searching for dictionaries.\nNo dictionary found.\n")); list = create_empty_dictionary_list(); } diff --git a/src/logwindow.c b/src/logwindow.c index d6acdf153..563561826 100644 --- a/src/logwindow.c +++ b/src/logwindow.c @@ -167,7 +167,7 @@ void log_window_clear(GtkWidget *text) gchar *str; length = gtk_text_get_length (GTK_TEXT (text)); - debug_print(_("Log window length: %u"), length); + debug_print(_("Log window length: %u\n"), length); if (length > prefs_common.loglength) { /* find the end of the first line after the cut off @@ -184,7 +184,7 @@ void log_window_clear(GtkWidget *text) /* erase the text */ gtk_text_set_point (GTK_TEXT (text), 0); if (!gtk_text_forward_delete (GTK_TEXT (text), point + 1)) - debug_print (_("Error clearing log")); + debug_print (_("Error clearing log\n")); gtk_text_thaw (GTK_TEXT (text)); gtk_text_set_point (GTK_TEXT (text), gtk_text_get_length (GTK_TEXT (text))); diff --git a/src/news.c b/src/news.c index 7347b83ac..f1d33847b 100644 --- a/src/news.c +++ b/src/news.c @@ -947,6 +947,7 @@ static GSList *news_delete_old_articles(GSList *alist, FolderItem *item, cur = next; } + debug_print(_("done.\n")); return alist; } @@ -1043,7 +1044,7 @@ GSList *news_get_num_list(Folder *folder, FolderItem *item) #define READ_TO_LISTEND(hdr) \ while (!(buf[0] == '.' && buf[1] == '\r')) { \ if (sock_gets(SESSION(session)->sock, buf, sizeof(buf)) < 0) { \ - log_warning(_("error occurred while getting " hdr ".\n")); \ + log_warning(_("error occurred while getting %s.\n"), hdr); \ return msginfo; \ } \ } diff --git a/src/rfc2015.c b/src/rfc2015.c index 7c0c3772b..58cf3a14d 100644 --- a/src/rfc2015.c +++ b/src/rfc2015.c @@ -417,7 +417,7 @@ leave: plain = NULL; } else - debug_print ("** decryption succeeded"); + debug_print ("** decryption succeeded\n"); gpgme_release (ctx); return plain; @@ -433,7 +433,7 @@ MimeInfo * rfc2015_find_signature (MimeInfo *mimeinfo) if (g_strcasecmp (mimeinfo->content_type, "multipart/signed")) return NULL; - debug_print ("** multipart/signed encountered"); + debug_print ("** multipart/signed encountered\n"); /* check that we have at least 2 parts of the correct type */ for (partinfo = mimeinfo->children; @@ -565,7 +565,7 @@ void rfc2015_decrypt_message (MsgInfo *msginfo, MimeInfo *mimeinfo, FILE *fp) g_return_if_fail (fp != NULL); g_return_if_fail (mimeinfo->mime_type == MIME_MULTIPART); - debug_print ("** decrypting multipart/encrypted message"); + debug_print ("** decrypting multipart/encrypted message\n"); /* skip headers */ if (fseek(fp, mimeinfo->fpos, SEEK_SET) < 0) @@ -596,7 +596,7 @@ void rfc2015_decrypt_message (MsgInfo *msginfo, MimeInfo *mimeinfo, FILE *fp) DECRYPTION_ABORT(); } - debug_print ("** yep, it is pgp encrypted"); + debug_print ("** yep, it is pgp encrypted\n"); plain = pgp_decrypt (partinfo, fp); if (!plain) { @@ -672,7 +672,7 @@ pgp_encrypt ( GpgmeData plain, GpgmeRecipients rset ) cipher = NULL; } else { - debug_print ("** encryption succeeded"); + debug_print ("** encryption succeeded\n"); } gpgme_release (ctx); -- 2.25.1