diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-05 12:57:58 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-05 12:57:58 +0100 |
commit | 2d0e4061c78be4c7d1fc713a7e2f199f26134658 (patch) | |
tree | eb68a54f825e13e7e1652820a37a7fe8fefeedc6 /src/fuzzy_storage.c | |
parent | 39fec823f124a82dd6a4bcd06a53a0ff062f4ac0 (diff) | |
download | rspamd-2d0e4061c78be4c7d1fc713a7e2f199f26134658.tar.gz rspamd-2d0e4061c78be4c7d1fc713a7e2f199f26134658.zip |
[Minor] Fix couple of warnings and disable -pedantic mode
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r-- | src/fuzzy_storage.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 7f3dd4020..1501da58e 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -712,28 +712,30 @@ rspamd_fuzzy_process_command (struct fuzzy_session *session) } reply: - result.tag = cmd->tag; - - memcpy (&session->reply.rep, &result, sizeof (result)); - - rspamd_fuzzy_update_stats (session->ctx, - session->epoch, - result.prob > 0.5, - is_shingle, - session->key_stat, - ip_stat, cmd->cmd, - result.value); - - if (encrypted) { - /* We need also to encrypt reply */ - ottery_rand_bytes (session->reply.hdr.nonce, - sizeof (session->reply.hdr.nonce)); - rspamd_cryptobox_encrypt_nm_inplace ((guchar *)&session->reply.rep, - sizeof (session->reply.rep), - session->reply.hdr.nonce, - session->nm, - session->reply.hdr.mac, - RSPAMD_CRYPTOBOX_MODE_25519); + if (cmd) { + result.tag = cmd->tag; + + memcpy (&session->reply.rep, &result, sizeof (result)); + + rspamd_fuzzy_update_stats (session->ctx, + session->epoch, + result.prob > 0.5, + is_shingle, + session->key_stat, + ip_stat, cmd->cmd, + result.value); + + if (encrypted) { + /* We need also to encrypt reply */ + ottery_rand_bytes (session->reply.hdr.nonce, + sizeof (session->reply.hdr.nonce)); + rspamd_cryptobox_encrypt_nm_inplace ((guchar *)&session->reply.rep, + sizeof (session->reply.rep), + session->reply.hdr.nonce, + session->nm, + session->reply.hdr.mac, + RSPAMD_CRYPTOBOX_MODE_25519); + } } rspamd_fuzzy_write_reply (session); @@ -926,7 +928,7 @@ rspamd_fuzzy_mirror_process_update (struct fuzzy_master_update_session *session, gchar *src = NULL, *psrc; gsize remain; gint32 revision, our_rev; - guint32 len, cnt = 0; + guint32 len = 0, cnt = 0; struct fuzzy_peer_cmd cmd, *pcmd; enum { read_len = 0, |