From 7b31d6a05357953c035e2ab05ec117ef748f7798 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Thu, 15 Oct 2026 12:40:44 +0300 Subject: Reject a scrollback above TERM_SCROLLBACK_MAX term_new() silently cut a scrollback above 1000000 lines to 1000000. The limit now has a name in term.h, and term_new() returns NULL above it, as it does for the other invalid options. Co-Authored-By: Claude Opus 5.5 --- include/term/term.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/term') diff --git a/include/term/term.h b/include/term/term.h index 380dfd3..c69e88e 100644 --- a/include/term/term.h +++ b/include/term/term.h @@ -40,6 +40,8 @@ struct term_snapshot; #define TERM_MAX_COLS 65535 /* The history limit when term_options.scrollback is 0. */ #define TERM_SCROLLBACK_DEFAULT 10000 +/* The largest term_options.scrollback. */ +#define TERM_SCROLLBACK_MAX 1000000 /* * The version of this header. A host compares TERM_VERSION_CODE with @@ -153,7 +155,8 @@ struct term_callbacks { /* * Options for term_new(). An all-zero value is valid. A size component of 0 * selects 80 columns or 24 rows. A negative component, or columns above - * TERM_MAX_COLS, makes term_new() fail. A negative scrollback fails too. + * TERM_MAX_COLS, makes term_new() fail. A scrollback below 0 or above + * TERM_SCROLLBACK_MAX fails too. * cursor_style must be a value of enum term_cursor_style. */ struct term_options { -- cgit v1.2.3