pinentry-dmenu

a pinentry program based on dmenu
git clone anongit@rnpnr.xyz:pinentry-dmenu.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 04aa49c38ffbe5604840e9d2d85a8c831b4b1aa0
Parent: acd96a07ccc1703c0b3aea86caac428265c99699
Author: NRK
Date:   Mon, 28 Mar 2022 01:02:52 +0600

drw_text: don't segfault when called with 0 width

this patch just rejects *any* 0 width draws, which is surely an error
by the caller.

this also guards against cases where the width is too small for the
ellipsis to fit, so ellipsis_w will remain 0.
reported by Bakkeby <bakkeby@gmail.com>

Diffstat:
Mdrw.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drw.c b/drw.c @@ -267,7 +267,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp enum { nomatches_len = 64 }; static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches; - if (!drw || (render && !drw->scheme) || !text || !drw->fonts) + if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts) return 0; if (!render) {