On 2012-05-18 Andreas Metzler <eximusers@???> wrote:
> On 2012-05-18 Phil Pennock <pdp@???> wrote:
> > I have uploaded Exim 4.80 RC1 to:
[...]
> I get a strange error when building with -Werror=format-security:
> ---------------------
> gcc -o em_main.o -c -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -Wall -fvisibility=hidden -I. -I../exim_monitor -I/usr/X11R6/include \
> ../exim_monitor/`echo em_main.o | sed 's/o$/c/'`
> ../exim_monitor/em_main.c: In function 'numlock_modifiers':
> ../exim_monitor/em_main.c:576:5: warning: 'XKeycodeToKeysym' is deprecated (declared at /usr/include/X11/Xlib.h:1695) [-Wdeprecated-declarations]
> ../exim_monitor/em_main.c: In function 'main':
> ../exim_monitor/em_main.c:659:3: error: format not a string literal and no format arguments [-Werror=format-security]
> cc1: some warnings being treated as errors
> make[2]: *** [em_main.o] Error 1
> ---------------------
> which corresponds to
> /* Do *not* use "%s" here, we need the %D datestamp in the log_file to
> be expanded! */
> (void)string_format(log_file_open, sizeof(log_file_open), CS log_file);
[...]
Hello,
Reverting a part of e0df1c8324f0e0c4112302fa473cff6a6110a044 makes the
problem unreproducible:
--- exim4-4.80~rc2.orig/src/functions.h
+++ exim4-4.80~rc2/src/functions.h
@@ -325,7 +325,7 @@ 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 *, ...) PRINTF_FUNCTION(3,4);
+extern BOOL string_format(uschar *, int, const char *, ...);
extern uschar *string_format_size(int, uschar *);
extern int string_interpret_escape(uschar **);
extern int string_is_ip_address(uschar *, int *);
What also makes exim compile is reverting this part of
c6e95d22d77f480804ddb5c505891206b427dfb1 (which was a partial revert
of abovementioned e0df1c8324f0e0c4112302fa473cff6a6110a044):
--- exim4-4.80~rc2.orig/exim_monitor/em_main.c
+++ exim4-4.80~rc2/exim_monitor/em_main.c
@@ -656,7 +656,7 @@ if (log_file[0] != 0)
{
/* Do *not* use "%s" here, we need the %D datestamp in the log_file to
be expanded! */
- (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;
cu andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'