*
* Adapted for Bacula -- note there were lots of bugs in
* the original code: %lld and %s were seriously broken, and
- * with FP turned off %f seg faults.
+ * with FP turned off %f seg faulted.
+ *
* Kern Sibbald, November MMV
*
* Version $Id$
#include "bacula.h"
#define FP_OUTPUT 1 /* Bacula uses floating point */
-
-/*
- Temp only for me -- NOT YET READY FOR USE -- seems to work fine
- on Linux, but doesn't build correctly on Win32
+/* Define the following if you want all the features of
+ * normal printf, but with all the security problems.
+ * For Bacula we turn this off, and it silently ignores
+ * formats that could pose a security problem.
*/
+#undef SECURITY_PROBLEM
+
#ifdef USE_BSNPRINTF
#ifdef HAVE_LONG_DOUBLE
int cflags;
int32_t currlen;
int base;
- int junk;
#ifdef FP_OUTPUT
LDOUBLE fvalue;
#endif
min = 10 * min + char_to_int(ch);
ch = *format++;
} else if (ch == '*') {
-#ifdef SECURITY_PROBLEM
min = va_arg(args, int);
-#else
- junk = va_arg(args, int);
-#endif
ch = *format++;
state = DP_S_DOT;
} else
max = 10 * max + char_to_int(ch);
ch = *format++;
} else if (ch == '*') {
-#ifdef SECURITY_PROBLEM
max = va_arg(args, int);
-#else
- junk = va_arg(args, int);
-#endif
ch = *format++;
state = DP_S_MOD;
} else
cflags = DP_C_LDOUBLE;
ch = *format++;
break;
+ case 'q': /* same as long long */
+ cflags = DP_C_INT64;
+ ch = *format++;
+ break;
default:
break;
}