From b33f2ced0bf0e74f3df2c477535a85529ca91a95 Mon Sep 17 00:00:00 2001 From: CismonX Date: Wed, 26 Feb 2025 14:46:29 +0800 Subject: [PATCH] fsck: limit history list length Add a hard limit to prevent the history command list from growing unnecessarily large, especially when interactive fsck is automated with scripting. --- src/fsck.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fsck.c b/src/fsck.c index 7ec4735..1ad7242 100644 --- a/src/fsck.c +++ b/src/fsck.c @@ -43,6 +43,10 @@ #include "lib.h" #include "xstd.h" +#ifndef BOOKMARKFS_FSCK_RL_HISTORY_MAX +# define BOOKMARKFS_FSCK_RL_HISTORY_MAX 256 +#endif + struct fsck_ctx { struct bookmarkfs_fsck_ops const *ops; struct bookmarkfs_fsck_handler const *handler; @@ -107,6 +111,7 @@ init_readline ( rl_initialize(); using_history(); + stifle_history(BOOKMARKFS_FSCK_RL_HISTORY_MAX); return 0; }