aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-28 09:40:04 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-28 09:40:04 +0100
commit00135c8f9a8dda4fe3ccdfe8a05bea691e73930a (patch)
treeb611245d14425eb04a66afd5f503542dd62da164 /src/libutil/util.c
parent7fc1dd5af0baa24d94acc28bda4ef37528ba7414 (diff)
downloadrspamd-00135c8f9a8dda4fe3ccdfe8a05bea691e73930a.tar.gz
rspamd-00135c8f9a8dda4fe3ccdfe8a05bea691e73930a.zip
[Minor] Slight types improvement
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r--src/libutil/util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index e7a5c2601..6f139d018 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -2507,15 +2507,17 @@ rspamd_time_jitter (gdouble in, gdouble jitter)
}
gboolean
-rspamd_constant_memcmp (const guchar *a, const guchar *b, gsize len)
+rspamd_constant_memcmp (const void *a, const void *b, gsize len)
{
gsize lena, lenb, i;
guint16 d, r = 0, m;
guint16 v;
+ const guint8 *aa = (const guint8 *)a,
+ *bb = (const guint8 *)b;
if (len == 0) {
- lena = strlen (a);
- lenb = strlen (b);
+ lena = strlen ((const char*)a);
+ lenb = strlen ((const char*)b);
if (lena != lenb) {
return FALSE;
@@ -2527,7 +2529,7 @@ rspamd_constant_memcmp (const guchar *a, const guchar *b, gsize len)
for (i = 0; i < len; i++) {
v = ((guint16)(guint8)r) + 255;
m = v / 256 - 1;
- d = (guint16)((int)a[i] - (int)b[i]);
+ d = (guint16)((int)aa[i] - (int)bb[i]);
r |= (d & m);
}