parse_rspamd_first_line (struct rspamd_connection *conn, guint len, GError **err)
{
gchar *b = conn->in_buf->str + sizeof("RSPAMD/") - 1, *p, *c;
- guint remain = len - sizeof("RSPAMD/") + 1, state = 0, next_state;
+ guint remain = len - sizeof("RSPAMD/") + 1, state = 0, next_state = 0;
gdouble dver;
p = b;
parse_rspamd_metric_line (struct rspamd_connection *conn, guint len, GError **err)
{
gchar *b = conn->in_buf->str + sizeof("Metric:") - 1, *p, *c, *err_str;
- guint remain = len - sizeof("Metric:") + 1, state = 0, next_state;
- struct rspamd_metric *new;
+ guint remain = len - sizeof("Metric:") + 1, state = 0, next_state = 0;
+ struct rspamd_metric *new = NULL;
p = b;
parse_rspamd_symbol_line (struct rspamd_connection *conn, guint len, GError **err)
{
gchar *b = conn->in_buf->str + sizeof("Symbol:") - 1, *p, *c, *err_str, *sym;
- guint remain = len - sizeof("Symbol:") + 1, state = 0, next_state, l;
- struct rspamd_symbol *new;
+ guint remain = len - sizeof("Symbol:") + 1, state = 0, next_state = 0, l;
+ struct rspamd_symbol *new = NULL;
p = b;
while (g_ascii_isspace (*p)) {
parse_rspamd_action_line (struct rspamd_connection *conn, guint len, GError **err)
{
gchar *b = conn->in_buf->str + sizeof("Action:") - 1, *p, *c, *sym;
- guint remain = len - sizeof("Action:") + 1, state = 0, next_state;
+ guint remain = len - sizeof("Action:") + 1, state = 0, next_state = 0;
p = b;
c = b;
parse_rspamd_header_line (struct rspamd_connection *conn, guint len, GError **err)
{
gchar *b = conn->in_buf->str, *p, *c, *hname = NULL, *hvalue = NULL;
- guint remain = len, state = 0, next_state;
+ guint remain = len, state = 0, next_state = 0;
p = b;
c = b;
GHashTable *module;
gchar *err_str;
struct option_callback_data cd;
+ union {
+ gint i;
+ gdouble d;
+ guint ui;
+ } t;
if (module_options == NULL) {
msg_warn ("no module options registered while checking option %s for module %s", mname, optname);
/* Allways OK */
return TRUE;
case MODULE_OPT_TYPE_INT:
- (void)strtol (data, &err_str, 10);
+ t.i = strtol (data, &err_str, 10);
if (*err_str != '\0') {
msg_warn ("non-numeric data for option: '%s' for module: '%s' at position: '%s'", optname, mname, err_str);
return FALSE;
}
+ (void)t.i;
break;
case MODULE_OPT_TYPE_UINT:
- (void)strtoul (data, &err_str, 10);
+ t.ui = strtoul (data, &err_str, 10);
if (*err_str != '\0') {
msg_warn ("non-numeric data for option: '%s' for module: '%s' at position: '%s'", optname, mname, err_str);
return FALSE;
}
+ (void)t.ui;
break;
case MODULE_OPT_TYPE_DOUBLE:
- (void)strtod (data, &err_str);
+ t.d = strtod (data, &err_str);
if (*err_str != '\0') {
msg_warn ("non-numeric data for option: '%s' for module: '%s' at position: '%s'", optname, mname, err_str);
return FALSE;
}
+ (void)t.d;
break;
case MODULE_OPT_TYPE_TIME:
- (void)cfg_parse_time (data, TIME_SECONDS);
+ t.ui = cfg_parse_time (data, TIME_SECONDS);
if (errno != 0) {
msg_warn ("non-numeric data for option: '%s' for module: '%s': %s", optname, mname, strerror (errno));
return FALSE;
}
+ (void)t.ui;
break;
case MODULE_OPT_TYPE_SIZE:
- (void)parse_limit (data, -1);
+ t.ui = parse_limit (data, -1);
if (errno != 0) {
msg_warn ("non-numeric data for option: '%s' for module: '%s': %s", optname, mname, strerror (errno));
return FALSE;
}
+ (void)t.ui;
break;
case MODULE_OPT_TYPE_MAP:
if (!check_map_proto (data, NULL, NULL)) {
_ses(const void *a, gint aoff, gint n, const void *b, gint boff,
gint m, struct _ctx *ctx)
{
- struct middle_snake ms;
+ struct middle_snake ms = {
+ .x = 0,
+ .y = 0,
+ .u = 0,
+ .v = 0
+ };
gint d;
if (n == 0) {
GMimeContentType *ct;
gint r;
gboolean recursive = FALSE, result = FALSE;
- GList *cur;
+ GList *cur = NULL;
struct mime_part *cur_part;
if (args == NULL) {
GMimeObject *part;
GMimeContentType *ct;
gboolean recursive = FALSE, result = FALSE;
- GList *cur;
+ GList *cur = NULL;
struct mime_part *cur_part;
if (args == NULL) {
GMimeContentType *ct;
gint r;
gboolean recursive = FALSE, result = FALSE;
- GList *cur;
+ GList *cur = NULL;
struct mime_part *cur_part;
if (args == NULL) {
GMimeContentType *ct;
gint r;
gboolean recursive = FALSE, result = FALSE;
- GList *cur;
+ GList *cur = NULL;
struct mime_part *cur_part;
if (args == NULL) {
{
struct kvstorage_config *kconf = value;
struct rspamd_kv_cache *cache;
- struct rspamd_kv_backend *backend;
- struct rspamd_kv_expire *expire;
+ struct rspamd_kv_backend *backend = NULL;
+ struct rspamd_kv_expire *expire = NULL;
switch (kconf->cache.type) {
case KVSTORAGE_TYPE_CACHE_HASH:
return FALSE;
}
else if (levels > 1) {
- chdir (nbuf);
+ if (chdir (nbuf) == -1) {
+ msg_err ("chdir to %s failed: %s", nbuf, strerror (errno));
+ return FALSE;
+ }
if (! rspamd_recursive_mkdir (levels - 1)) {
return FALSE;
}
- chdir ("../");
+ if (chdir ("../") == -1) {
+ msg_err ("chdir to ../ failed: %s", strerror (errno));
+ return FALSE;
+ }
}
}
}
db->initialized = TRUE;
- chdir (pathbuf);
+ if (chdir (pathbuf) == -1) {
+ msg_err ("chdir to %s failed: %s", pathbuf, strerror (errno));
+ }
return;
err:
if (pathbuf[0] != '\0') {
- chdir (pathbuf);
+ if (chdir (pathbuf) == -1) {
+ msg_err ("chdir to %s failed: %s", pathbuf, strerror (errno));
+ }
}
}
parse_kvstorage_line (struct kvstorage_session *session, f_str_t *in)
{
gchar *p, *c, *end;
- gint state = 0, next_state;
+ gint state = 0, next_state = 0;
gboolean is_redis;
p = in->begin;
gchar *p = in->begin, *end = in->begin + in->len, *c;
gint state = 0;
+ c = p;
while (p < end) {
switch (state) {
case 0:
struct kvstorage_session *session = (struct kvstorage_session *) arg;
struct kvstorage_worker_thread *thr;
gint r;
- guint arglen;
+ guint arglen = 0;
gchar outbuf[BUFSIZ];
gboolean is_redis;
static void
process_raw_headers (struct worker_task *task)
{
- struct raw_header *new, *lp;
+ struct raw_header *new = NULL, *lp;
gchar *p, *c, *tmp, *tp;
- gint state = 0, l, next_state, err_state, t_state;
+ gint state = 0, l, next_state = 100, err_state = 100, t_state;
gboolean valid_folding = FALSE;
p = task->raw_headers_str;
parse_http_command (struct worker_task *task, f_str_t * line)
{
guint8 *p, *end, *c;
- gint state = 0, next_state;
+ gint state = 0, next_state = 0;
gchar *cmd;
p = line->begin;
+ c = p;
end = p + line->len;
task->proto = RSPAMC_PROTO;
{
const gchar *p;
gchar stop;
- guint i;
+ guint i;
p = pos + strlen (match->pattern);
+ stop = *p;
if (*p == '/') {
p ++;
}
if (main->is_privilleged) {
/* Force root user as owner of pid file */
- fchown (main->pfh->pf_fd, 0, 0);
+ if (fchown (main->pfh->pf_fd, 0, 0) == -1) {
+ msg_err ("cannot chown of pidfile %s to 0:0 user", main->cfg->pid_file);
+ }
}
rspamd_pidfile_write (main->pfh);