]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix some more issues
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Sep 2021 11:27:10 +0000 (12:27 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Sep 2021 11:27:10 +0000 (12:27 +0100)
Found by: coverity scan

src/libserver/http/http_router.c
src/libserver/logger/logger.c
src/libserver/milter.c

index 960df0ce311af6701d2986c8843ff4b0ba80c5aa..9ff1195ade2a032b42c8934579bde87bcff1f0ab 100644 (file)
@@ -199,6 +199,7 @@ rspamd_http_router_try_file (struct rspamd_http_connection_entry *entry,
        rspamd_http_router_insert_headers (entry->rt, reply_msg);
 
        if (!rspamd_http_message_set_body_from_fd (reply_msg, fd)) {
+               rspamd_http_message_free (reply_msg);
                close (fd);
                return FALSE;
        }
index f65d0fb2ea69dc338e5599511d751fc72e7f75b6..07625bb91bd78b2b061e321a53628efb38d5bb4b 100644 (file)
@@ -227,16 +227,21 @@ rspamd_log_open_specific (rspamd_mempool_t *pool,
 
        const struct rspamd_logger_funcs *funcs = NULL;
 
-       switch (cfg->log_type) {
-       case RSPAMD_LOG_CONSOLE:
+       if (cfg) {
+               switch (cfg->log_type) {
+               case RSPAMD_LOG_CONSOLE:
+                       funcs = &console_log_funcs;
+                       break;
+               case RSPAMD_LOG_SYSLOG:
+                       funcs = &syslog_log_funcs;
+                       break;
+               case RSPAMD_LOG_FILE:
+                       funcs = &file_log_funcs;
+                       break;
+               }
+       }
+       else {
                funcs = &console_log_funcs;
-               break;
-       case RSPAMD_LOG_SYSLOG:
-               funcs = &syslog_log_funcs;
-               break;
-       case RSPAMD_LOG_FILE:
-               funcs = &file_log_funcs;
-               break;
        }
 
        g_assert (funcs != NULL);
index 301c26a1f7b6613f7643e0a3eb00e9bd6eb40bb2..142f50c92f81f74268f12427a4524088baa40d96 100644 (file)
@@ -846,25 +846,25 @@ rspamd_milter_consume_input (struct rspamd_milter_session *session,
                case st_len_1:
                        /* The first length byte in big endian order */
                        priv->parser.datalen = 0;
-                       priv->parser.datalen |= *p << 24;
+                       priv->parser.datalen |= ((gsize)*p) << 24;
                        priv->parser.state = st_len_2;
                        p++;
                        break;
                case st_len_2:
                        /* The second length byte in big endian order */
-                       priv->parser.datalen |= *p << 16;
+                       priv->parser.datalen |= ((gsize)*p) << 16;
                        priv->parser.state = st_len_3;
                        p++;
                        break;
                case st_len_3:
                        /* The third length byte in big endian order */
-                       priv->parser.datalen |= *p << 8;
+                       priv->parser.datalen |= ((gsize)*p) << 8;
                        priv->parser.state = st_len_4;
                        p++;
                        break;
                case st_len_4:
                        /* The fourth length byte in big endian order */
-                       priv->parser.datalen |= *p;
+                       priv->parser.datalen |= ((gsize)*p);
                        priv->parser.state = st_read_cmd;
                        p++;
                        break;