[dovecot-cvs] dovecot: Use printf_string_fix_format() instead of printf_string...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jun 11 01:01:00 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/2cde91fb7283
changeset: 5678:2cde91fb7283
user: Timo Sirainen <tss at iki.fi>
date: Mon Jun 11 01:00:56 2007 +0300
description:
Use printf_string_fix_format() instead of printf_string_upper_bound() to
convert %m and verify that %n isn't used.
diffstat:
1 file changed, 6 insertions(+), 12 deletions(-)
src/lib/failures.c | 18 ++++++------------
diffs (63 lines):
diff -r 922607d52fba -r 2cde91fb7283 src/lib/failures.c
--- a/src/lib/failures.c Mon Jun 11 01:00:07 2007 +0300
+++ b/src/lib/failures.c Mon Jun 11 01:00:56 2007 +0300
@@ -5,7 +5,6 @@
#include "backtrace-string.h"
#include "write-full.h"
#include "fd-close-on-exec.h"
-#include "printf-upper-bound.h"
#include <stdio.h>
#include <stdlib.h>
@@ -83,7 +82,7 @@ default_handler(const char *prefix, FILE
if (recursed == 2) {
/* we're being called from some signal handler, or
- printf_string_upper_bound() killed us again */
+ printf_string_fix_format() killed us again */
return -1;
}
@@ -100,7 +99,7 @@ default_handler(const char *prefix, FILE
t_push();
if (recursed == 2) {
- /* printf_string_upper_bound() probably killed us last time,
+ /* printf_string_fix_format() probably killed us last time,
just write the format now. */
fputs("recursed: ", f);
@@ -114,8 +113,7 @@ default_handler(const char *prefix, FILE
errno = old_errno;
/* make sure there's no %n in there and fix %m */
- (void)printf_string_upper_bound(&format, args);
- vfprintf(f, format, args2);
+ vfprintf(f, printf_string_fix_format(format), args2);
}
fputc('\n', f);
@@ -281,8 +279,6 @@ static int __attr_format__(2, 0)
static int __attr_format__(2, 0)
syslog_handler(int level, const char *format, va_list args)
{
- va_list args2;
-
static int recursed = 0;
if (recursed != 0)
@@ -290,11 +286,9 @@ syslog_handler(int level, const char *fo
recursed++;
- /* make sure there's no %n in there */
- VA_COPY(args2, args);
- (void)printf_string_upper_bound(&format, args);
-
- vsyslog(level, format, args2);
+ /* make sure there's no %n in there. vsyslog() supports %m, but since
+ we'll convert it ourself anyway, we might as well it */
+ vsyslog(level, printf_string_fix_format(format), args);
recursed--;
return 0;
More information about the dovecot-cvs
mailing list