]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Segfault for some configuration. 3292/head
authorThierry Fournier <thierry.fournier@ozon.io>
Sat, 7 Mar 2020 13:48:31 +0000 (14:48 +0100)
committerThierry Fournier <thierry.fournier@ozon.io>
Tue, 10 Mar 2020 16:24:47 +0000 (17:24 +0100)
When the configuration file contains only these two lines, rspamd
try to send log which announce that it can bind the soket, but
"bind_conf" is NULL and it is dereferenced, so we have a segfault.

   worker "normal" {
   }

This patch fix the segfault.

src/rspamd.c

index 12f0cae2c7c319a2d342114a14c0061214d49cb4..dee990c419169a2aa941582ec317207129d3ff82 100644 (file)
@@ -706,8 +706,13 @@ spawn_workers (struct rspamd_main *rspamd_main, struct ev_loop *ev_base)
                                        spawn_worker_type (rspamd_main, ev_base, cf);
                                }
                                else {
-                                       msg_err_main ("cannot create listen socket for %s at %s",
-                                                       g_quark_to_string (cf->type), cf->bind_conf->name);
+                                       if (cf->bind_conf == NULL) {
+                                               msg_err_main ("cannot create listen socket for %s",
+                                                               g_quark_to_string (cf->type));
+                                       } else {
+                                               msg_err_main ("cannot create listen socket for %s at %s",
+                                                               g_quark_to_string (cf->type), cf->bind_conf->name);
+                                       }
 
                                        rspamd_hard_terminate (rspamd_main);
                                        g_assert_not_reached ();