Browse Source

Fix several potential problems found by static analysis.

tags/0.5.5
Vsevolod Stakhov 11 years ago
parent
commit
3b025570d4
4 changed files with 12 additions and 6 deletions
  1. 8
    2
      src/cfg_xml.c
  2. 2
    2
      src/dkim.c
  3. 1
    1
      src/expressions.h
  4. 1
    1
      src/lua/lua_buffer.c

+ 8
- 2
src/cfg_xml.c View 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);


+ 2
- 2
src/dkim.c View 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;
}

+ 1
- 1
src/expressions.h View 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

+ 1
- 1
src/lua/lua_buffer.c View 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) {

Loading…
Cancel
Save