diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-05 23:19:46 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-05 23:19:46 +0000 |
commit | c712ffe5b94f3087e53c637352584d120ebc8452 (patch) | |
tree | eb8cc9783ba22111fcfee0505936718f1010f76a /src | |
parent | aed148fd3035e7392e52a71f82b576f52d8986c3 (diff) | |
download | rspamd-c712ffe5b94f3087e53c637352584d120ebc8452.tar.gz rspamd-c712ffe5b94f3087e53c637352584d120ebc8452.zip |
Fix couple of issues with new encoding functions
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/str_util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c index 6a0e4f4e7..c8f4088e1 100644 --- a/src/libutil/str_util.c +++ b/src/libutil/str_util.c @@ -629,7 +629,8 @@ rspamd_decode_base32 (const gchar *in, gsize inlen, gsize *outlen) { guchar *res; - gsize olen = 0, i, allocated_len = inlen * 5 / 8 + 2; + gsize allocated_len = inlen * 5 / 8 + 2; + gint olen; res = g_malloc (allocated_len); @@ -1334,11 +1335,10 @@ rspamd_encode_hex_buf (const guchar *in, gsize inlen, gchar *out, const guchar *p; static const gchar hexdigests[16] = "0123456789abcdef"; - end = out + end; + end = out + outlen; o = out; p = in; - while (inlen > 0 && o < end - 1) { *o++ = hexdigests[((*p >> 4) & 0xF)]; *o++ = hexdigests[((*p++) & 0xF)]; @@ -1379,7 +1379,7 @@ rspamd_encode_hex (const guchar *in, gsize inlen) } gint -rspamd_decode_hex_buf (const gchar *in, gsize inlen, gsize inlen, +rspamd_decode_hex_buf (const gchar *in, gsize inlen, guchar *out, gsize outlen) { guchar *o, *end, ret; |