]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Rework] Use more predictable size for commands buffers
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 23 Oct 2022 17:00:01 +0000 (18:00 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 23 Oct 2022 17:00:01 +0000 (18:00 +0100)
src/libserver/rspamd_control.h

index f6336854cf5121330e7561dacbdde4796276a9e1..1c0f593e325abffc61251cfd4bdaa4de218576e7 100644 (file)
@@ -52,7 +52,7 @@ enum rspamd_srv_type {
 enum rspamd_log_pipe_type {
        RSPAMD_LOG_PIPE_SYMBOLS = 0,
 };
-#define CONTROL_PATHLEN 400
+#define CONTROL_PATHLEN MIN(PATH_MAX, PIPE_BUF - sizeof(int) * 2)
 struct rspamd_control_command {
        enum rspamd_control_type type;
        union {
@@ -69,8 +69,8 @@ struct rspamd_control_command {
                        guint unused;
                } recompile;
                struct {
-                       gchar cache_dir[CONTROL_PATHLEN];
                        gboolean forced;
+                       gchar cache_dir[CONTROL_PATHLEN];
                } hs_loaded;
                struct {
                        gchar tag[32];