summaryrefslogtreecommitdiffstats
path: root/src/libutil/str_util.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-13 12:43:49 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-09-13 12:43:49 +0100
commitd8837eff359da457a5573edc9fdad5d04a41ad12 (patch)
treec1c015c009171b8d37ae005a878dc681fe328d0c /src/libutil/str_util.h
parent5480f08714f4ce095ea9cb4d881c11b225e949c4 (diff)
downloadrspamd-d8837eff359da457a5573edc9fdad5d04a41ad12.tar.gz
rspamd-d8837eff359da457a5573edc9fdad5d04a41ad12.zip
[Minor] Add support for address sanitizer
Diffstat (limited to 'src/libutil/str_util.h')
-rw-r--r--src/libutil/str_util.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h
index 9fa914292..73637a62c 100644
--- a/src/libutil/str_util.h
+++ b/src/libutil/str_util.h
@@ -74,7 +74,18 @@ gboolean rspamd_gstring_icase_equal (gconstpointer v, gconstpointer v2);
* @param siz length of destination buffer
* @return bytes copied
*/
-gsize rspamd_strlcpy (gchar *dst, const gchar *src, gsize siz);
+gsize rspamd_strlcpy_fast (gchar *dst, const gchar *src, gsize siz);
+gsize rspamd_strlcpy_safe (gchar *dst, const gchar *src, gsize siz);
+
+#if defined(__has_feature)
+# if __has_feature(address_sanitizer)
+# define rspamd_strlcpy rspamd_strlcpy_safe
+# else
+# define rspamd_strlcpy rspamd_strlcpy_fast
+# endif
+#else
+# define rspamd_strlcpy rspamd_strlcpy_fast
+#endif
/*
* Try to convert string of length to long