#define static_assert_array_size(arr, count) \
static_assert(N_ELEMENTS(arr) == (count), "array/enum size mismatch")
+/* Using memcpy() with NULL pointers is undefined behavior. Make sure we don't
+ do that. */
+static inline void *i_memcpy(void *dest, const void *src, size_t n) {
+ i_assert(dest != NULL && src != NULL);
+ return memcpy(dest, src, n);
+}
+#define memcpy(dest, src, n) i_memcpy(dest, src, n)
+
/* /dev/null opened as O_WRONLY. Opened at lib_init(), so it can be accessed
also inside chroots. */
extern int dev_null_fd;
#include "lib.h"
#include "printf-format-fix.h"
+/* Disable our memcpy() safety wrapper. This file is very performance sensitive
+ and it's been checked to work correctly with memcpy(). */
+#undef memcpy
+
static const char *
fix_format_real(const char *fmt, const char *p, size_t *len_r)
{
#include <limits.h>
#include <ctype.h>
+/* Disable our memcpy() safety wrapper. This file is very performance sensitive
+ and it's been checked to work correctly with memcpy(). */
+#undef memcpy
+
#define STRCONCAT_BUFSIZE 512
enum _str_trim_sides {