]> source.dussan.org Git - rspamd.git/commitdiff
Fix several potential problems found by static analysis.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 May 2013 12:11:52 +0000 (13:11 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 24 May 2013 12:11:52 +0000 (13:11 +0100)
src/cfg_xml.c
src/dkim.c
src/expressions.h
src/lua/lua_buffer.c

index 3227728256e81aaf2ef5cb20b520e9fcfc9938ca..054377059f39d723f050cd1630094f377c5c054f 100644 (file)
@@ -897,8 +897,10 @@ worker_foreach_callback (gpointer k, gpointer v, gpointer ud)
        GList                          *cur;
        GHashTable                     *worker_config;
 
-       if (!worker_options || (worker_config = g_hash_table_lookup (worker_options, &cd->wrk->type)) == NULL ||
-                       (cparam = g_hash_table_lookup (worker_config, k)) == NULL) {
+       if (!worker_options || (worker_config = g_hash_table_lookup (worker_options, &cd->wrk->type)) == NULL) {
+               return;
+       }
+       if ((cparam = g_hash_table_lookup (worker_config, k)) == NULL) {
                /* Try to use universal handler if there is no specific handler */
                if ((cparam = g_hash_table_lookup (worker_config, "*")) != NULL) {
                        if (cd->wrk->ctx != NULL) {
@@ -1114,6 +1116,10 @@ handle_metric_symbol (struct config_file *cfg, struct rspamd_xml_userdata *ctx,
                        group = "ungrouped";
                }
        }
+       else {
+               group = "ungrouped";
+               sym_def->description = NULL;
+       }
 
        g_hash_table_insert (metric->symbols, sym_def->name, value);
 
index feb11893d74faa37db30b2e44145d8da6c7b832e..157b13aee48d75e8cfaee05b55ee8fff1268cb75 100644 (file)
@@ -579,14 +579,14 @@ rspamd_create_dkim_context (const gchar *sig, memory_pool_t *pool, guint time_ji
        }
        if (new->sig_alg == DKIM_SIGN_RSASHA1) {
                /* Check bh length */
-               if (new->bhlen != g_checksum_type_get_length (G_CHECKSUM_SHA1)) {
+               if (new->bhlen != (guint)g_checksum_type_get_length (G_CHECKSUM_SHA1)) {
                        g_set_error (err, DKIM_ERROR, DKIM_SIGERROR_BADSIG, "signature has incorrect length: %ud", new->bhlen);
                        return NULL;
                }
 
        }
        else if (new->sig_alg == DKIM_SIGN_RSASHA256) {
-               if (new->bhlen != g_checksum_type_get_length (G_CHECKSUM_SHA256)) {
+               if (new->bhlen != (guint)g_checksum_type_get_length (G_CHECKSUM_SHA256)) {
                        g_set_error (err, DKIM_ERROR, DKIM_SIGERROR_BADSIG, "signature has incorrect length: %ud", new->bhlen);
                        return NULL;
                }
index 6f42fa3e49b649b38158cf989e73ef7352e36828..1ec3106c0011ffd85e7e598438269764fe2e0e0e 100644 (file)
@@ -97,7 +97,7 @@ void re_cache_add (const gchar *line, void *pointer, memory_pool_t *pool);
  * @param line symbolic representation
  * @return pointer to regexp data or NULL if regexp is not found
  */
-void * re_cache_check (const const gchar *line, memory_pool_t *pool);
+void * re_cache_check (const gchar *line, memory_pool_t *pool);
 
 /**
  * Remove regexp from regexp cache
index b7a460b52575c2c49ed809aedfaeb1db17776c41..ee2b5d158697b17f9049528c6dc9a69b44d0c64b 100644 (file)
@@ -106,7 +106,7 @@ static                          gboolean
 lua_io_write_cb (void *arg)
 {
        struct lua_dispatcher_cbdata                                    *cbdata = arg;
-       gboolean                                                                                  res;
+       gboolean                                                                                  res = FALSE;
        rspamd_io_dispatcher_t                                                  **pdispatcher;
 
        if (cbdata->cbref_write) {