From: Dirk Mueller Date: Sun, 22 Apr 2012 18:21:32 +0000 (+0100) Subject: Mark cases where printf format strings are used X-Git-Tag: exim-4_80_RC1~62^2 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/e0df1c8324f0e0c4112302fa473cff6a6110a044 Mark cases where printf format strings are used Bug report from Lars Müller (via SUSE), Patch from Dirk Mueller --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index ee63f414e..676aa534c 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -45,6 +45,10 @@ PP/12 MAIL args handles TAB as well as SP, for better interop with non-compliant senders. Analysis and variant patch by Todd Lyons. +NM/04 Bugzilla 1237 - fix cases where printf format usage no indicated + Bug report from Lars Müller (via SUSE), + Patch from Dirk Mueller + Exim version 4.77 ----------------- diff --git a/src/exim_monitor/em_log.c b/src/exim_monitor/em_log.c index 3f4551a07..baa4c8996 100644 --- a/src/exim_monitor/em_log.c +++ b/src/exim_monitor/em_log.c @@ -56,6 +56,8 @@ static int scrolled = FALSE; static int size = 0; static int top = 0; +static void show_log(char *s, ...) PRINTF_FUNCTION(1,2); + static void show_log(char *s, ...) { int length, newtop; @@ -362,7 +364,7 @@ link count of zero on the currently open file. */ if (log_datestamping) { uschar log_file_wanted[256]; - string_format(log_file_wanted, sizeof(log_file_wanted), CS log_file); + string_format(log_file_wanted, sizeof(log_file_wanted), "%s", CS log_file); if (Ustrcmp(log_file_wanted, log_file_open) != 0) { if (LOG != NULL) diff --git a/src/exim_monitor/em_main.c b/src/exim_monitor/em_main.c index 22a721d52..7193640a5 100644 --- a/src/exim_monitor/em_main.c +++ b/src/exim_monitor/em_main.c @@ -654,7 +654,7 @@ today.) */ if (log_file[0] != 0) { - (void)string_format(log_file_open, sizeof(log_file_open), CS log_file); + (void)string_format(log_file_open, sizeof(log_file_open), "%s", CS log_file); log_datestamping = string_datestamp_offset >= 0; LOG = fopen(CS log_file_open, "r"); diff --git a/src/exim_monitor/em_text.c b/src/exim_monitor/em_text.c index ba13ff104..e39ec0298 100644 --- a/src/exim_monitor/em_text.c +++ b/src/exim_monitor/em_text.c @@ -58,6 +58,8 @@ XawTextSetInsertionPoint(w, text_count); * Display text from format * *************************************************/ +void text_showf(Widget w, char *s, ...) PRINTF_FUNCTION(2,3); + void text_showf(Widget w, char *s, ...) { va_list ap; diff --git a/src/src/demime.c b/src/src/demime.c index ca295f98e..887678db3 100644 --- a/src/src/demime.c +++ b/src/src/demime.c @@ -821,7 +821,7 @@ void mime_trigger_error(int level, uschar *format, ...) { (void)string_vformat(US f, 16383,(char *)format, ap); va_end(ap); f-=22; - log_write(0, LOG_MAIN, f); + log_write(0, LOG_MAIN, "%s", f); /* then copy to demime_reason_buffer if new level is greater than old level */ if (level > demime_errorlevel) { diff --git a/src/src/functions.h b/src/src/functions.h index d2575946b..9e8a9546f 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -82,7 +82,7 @@ extern void decode_bits(unsigned int *, unsigned int *, int, int, uschar *, bit_table *, int, uschar *, int); extern address_item *deliver_make_addr(uschar *, BOOL); extern int deliver_message(uschar *, BOOL, BOOL); -extern void deliver_msglog(const char *, ...); +extern void deliver_msglog(const char *, ...) PRINTF_FUNCTION(1,2); extern void deliver_set_expansions(address_item *); extern int deliver_split_address(address_item *); extern void deliver_succeeded(address_item *); @@ -182,9 +182,9 @@ extern int mime_regex(uschar **); extern uschar *moan_check_errorcopy(uschar *); extern BOOL moan_skipped_syntax_errors(uschar *, error_block *, uschar *, BOOL, uschar *); -extern void moan_smtp_batch(uschar *, const char *, ...); +extern void moan_smtp_batch(uschar *, const char *, ...) PRINTF_FUNCTION(2,3); extern void moan_tell_someone(uschar *, address_item *, - const uschar *, const char *, ...); + const uschar *, const char *, ...) PRINTF_FUNCTION(4,5); extern BOOL moan_to_sender(int, error_block *, header_line *, FILE *, BOOL); extern void moan_write_from(FILE *); extern FILE *modefopen(const uschar *, const char *, mode_t); @@ -272,7 +272,7 @@ extern int search_findtype_partial(uschar *, int *, uschar **, int *, int *); extern void *search_open(uschar *, int, int, uid_t *, gid_t *); extern void search_tidyup(void); -extern void set_process_info(const char *, ...); +extern void set_process_info(const char *, ...) PRINTF_FUNCTION(1,2); extern void sha1_end(sha1 *, const uschar *, int, uschar *); extern void sha1_mid(sha1 *, const uschar *); extern void sha1_start(sha1 *); @@ -300,7 +300,7 @@ extern int smtp_setup_msg(void); extern BOOL smtp_start_session(void); extern int smtp_ungetc(int); extern BOOL smtp_verify_helo(void); -extern int smtp_write_command(smtp_outblock *, BOOL, const char *, ...); +extern int smtp_write_command(smtp_outblock *, BOOL, const char *, ...) PRINTF_FUNCTION(3,4); #ifdef WITH_CONTENT_SCAN extern int spam(uschar **); extern FILE *spool_mbox(unsigned long *, uschar *); @@ -322,13 +322,13 @@ extern uschar *string_copy_malloc(uschar *); extern uschar *string_copylc(uschar *); extern uschar *string_copynlc(uschar *, int); extern uschar *string_dequote(uschar **); -extern BOOL string_format(uschar *, int, const char *, ...); +extern BOOL string_format(uschar *, int, const char *, ...) PRINTF_FUNCTION(3,4); extern uschar *string_format_size(int, uschar *); extern int string_interpret_escape(uschar **); extern int string_is_ip_address(uschar *, int *); extern uschar *string_log_address(address_item *, BOOL, BOOL); extern uschar *string_nextinlist(uschar **, int *, uschar *, int); -extern uschar *string_open_failed(int, const char *, ...); +extern uschar *string_open_failed(int, const char *, ...) PRINTF_FUNCTION(2,3); extern uschar *string_printing2(uschar *, BOOL); extern uschar *string_split_message(uschar *); extern BOOL string_vformat(uschar *, int, const char *, va_list); diff --git a/src/src/local_scan.h b/src/src/local_scan.h index c1d54d497..25b194407 100644 --- a/src/src/local_scan.h +++ b/src/src/local_scan.h @@ -173,7 +173,7 @@ extern void header_add_at_position(BOOL, uschar *, BOOL, int, const char *, . extern void header_remove(int, const uschar *); extern BOOL header_testname(header_line *, const uschar *, int, BOOL); extern BOOL header_testname_incomplete(header_line *, const uschar *, int, BOOL); -extern void log_write(unsigned int, int, const char *format, ...); +extern void log_write(unsigned int, int, const char *format, ...) PRINTF_FUNCTION(3,4); extern int lss_b64decode(uschar *, uschar **); extern uschar *lss_b64encode(uschar *, int); extern int lss_match_domain(uschar *, uschar *); @@ -188,6 +188,6 @@ extern void smtp_printf(const char *, ...) PRINTF_FUNCTION(1,2); extern void smtp_vprintf(const char *, va_list); extern uschar *string_copy(uschar *); extern uschar *string_copyn(uschar *, int); -extern uschar *string_sprintf(const char *, ...); +extern uschar *string_sprintf(const char *, ...) PRINTF_FUNCTION(1,2); /* End of local_scan.h */