commit 5a13ff4: [Rework] Use more predictable size for commands buffers

Vsevolod Stakhov vsevolod at rspamd.com
Sun Oct 23 17:14:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-10-23 18:00:01 +0100
URL: https://github.com/rspamd/rspamd/commit/5a13ff46447fc15c3c941517681525eed0d4a458

[Rework] Use more predictable size for commands buffers

---
 src/libserver/rspamd_control.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libserver/rspamd_control.h b/src/libserver/rspamd_control.h
index f6336854c..1c0f593e3 100644
--- a/src/libserver/rspamd_control.h
+++ b/src/libserver/rspamd_control.h
@@ -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];


More information about the Commits mailing list