]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix size of length in fuzzy mirror wire protocol
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 27 Jun 2016 13:54:59 +0000 (14:54 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 27 Jun 2016 13:54:59 +0000 (14:54 +0100)
src/fuzzy_storage.c

index cfb29c0b754d9b8256e315278a086864643fdac6..2c56bed5e7900188b11777881eff256526e01829 100644 (file)
@@ -258,7 +258,7 @@ fuzzy_mirror_updates_to_http (struct rspamd_fuzzy_storage_ctx *ctx,
 {
        GList *cur;
        struct fuzzy_peer_cmd *io_cmd;
-       gsize len;
+       guint32 len;
        guint32 rev;
        const gchar *p;
        rspamd_fstring_t *reply;
@@ -297,6 +297,7 @@ fuzzy_mirror_updates_to_http (struct rspamd_fuzzy_storage_ctx *ctx,
                }
 
                p = (const char *)io_cmd;
+               len = GUINT32_TO_LE (len);
                reply = rspamd_fstring_append (reply, (const char *)&len, sizeof (len));
                reply = rspamd_fstring_append (reply, p, len);
        }
@@ -1000,7 +1001,8 @@ rspamd_fuzzy_mirror_process_update (struct fuzzy_master_update_session *session,
                        break;
                case read_data:
                        if (remain < len) {
-                               msg_err ("short update message while reading data, not processing");
+                               msg_err ("short update message while reading data, not processing"
+                                               " (%zd is available, %d is required)", remain, len);
                                return;
                        }