From 8ee9dc17e1ca61c630f91db0aa7f81fa29a32040 Mon Sep 17 00:00:00 2001 From: Chongyu Guo Date: Wed, 30 Apr 2025 18:27:17 +0800 Subject: [PATCH] fix terminfo header memory check --- termbox2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/termbox2.h b/termbox2.h index 2d6775c..070fe98 100644 --- a/termbox2.h +++ b/termbox2.h @@ -3290,7 +3290,7 @@ static int parse_terminfo_caps(void) { // description of this behavior. // Ensure there's at least a header's worth of data - if (global.nterminfo < 6) return TB_ERR; + if (global.nterminfo < 6 * (int)sizeof(int16_t)) return TB_ERR; int16_t magic_number, nbytes_names, nbytes_bools, num_ints, num_offsets, nbytes_strings; -- 2.39.5