[dovecot-cvs] dovecot/src/lib failures.c,1.9,1.10

cras at procontrol.fi cras at procontrol.fi
Sun Dec 22 00:28:09 EET 2002


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv10230/src/lib

Modified Files:
	failures.c 
Log Message:
Compile with -Wformat-nonliteral now. Found a format string bug with it :(
But lucky for us, we haven't allowed %n in format strings for a few months
now and those bugs were added after that. So arbitrary code execution
vulnerabilities count is still zero :)



Index: failures.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/failures.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- failures.c	20 Dec 2002 01:47:11 -0000	1.9
+++ failures.c	21 Dec 2002 22:28:07 -0000	1.10
@@ -52,6 +52,15 @@
 static FILE *log_fd = NULL, *log_info_fd = NULL;
 static char *log_prefix = NULL, *log_stamp_format = NULL;
 
+/* kludgy .. we want to trust log_stamp_format with -Wformat-nonliteral */
+static const char *get_log_stamp_format(const char *unused)
+	__attr_format_arg__(1);
+
+static const char *get_log_stamp_format(const char *unused __attr_unused__)
+{
+	return log_stamp_format;
+}
+
 static void write_prefix(FILE *f)
 {
 	struct tm *tm;
@@ -63,7 +72,8 @@
 	if (log_stamp_format != NULL) {
 		tm = localtime(&ioloop_time);
 
-		if (strftime(str, sizeof(str), log_stamp_format, tm) > 0)
+		if (strftime(str, sizeof(str),
+			     get_log_stamp_format("unused"), tm) > 0)
 			fputs(str, f);
 	}
 }




More information about the dovecot-cvs mailing list