From 45a46fa4a364430d5c28a49aeb00bea7f9e804ab Mon Sep 17 00:00:00 2001 From: speedie Date: Sat, 18 Mar 2023 13:07:15 +0100 Subject: [PATCH] fix a possible segmentation fault --- libs/define.c | 3 +++ libs/draw.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/define.c b/libs/define.c index 03bc275..da6035d 100644 --- a/libs/define.c +++ b/libs/define.c @@ -11,6 +11,9 @@ #define NUMBERSMAXDIGITS 100 #define NUMBERSBUFSIZE (NUMBERSMAXDIGITS * 2) + 1 +// item +#define MAXITEMLENGTH 1024 + // user friendly names for all the modifiers #define CONTROL ControlMask #define SHIFT ShiftMask diff --git a/libs/draw.c b/libs/draw.c index ca53151..277eeaf 100644 --- a/libs/draw.c +++ b/libs/draw.c @@ -39,7 +39,7 @@ drawhighlights(struct item *item, int x, int y, int w) int drawitem(struct item *item, int x, int y, int w) { - char buffer[sizeof(item->text) + lrpad / 2]; + char buffer[MAXITEMLENGTH]; Clr scm[3]; int lp = lrpad / 2; // padding int wr, rd;