sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit edb683070a46f17242618569dacff02b6075115e
parent c29025f3cc818b8e0f43d41d9a7d4b3220503cfa
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed,  6 Jul 2022 19:17:36 +0200

ui_txt: fix a crash while searching

Reproducable with an empty search string when using '/'.

Reported by pi31415 on IRC in #gopherproject, thanks!

Diffstat:
Mui_txt.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui_txt.c b/ui_txt.c @@ -197,7 +197,7 @@ Item * uiselectitem(Item *entry) { Dir *dir; - char buf[BUFSIZ], *sstr, nl; + char buf[BUFSIZ], *sstr = NULL, nl; int item, nitems; if (!entry || !(dir = entry->dat)) @@ -281,7 +281,7 @@ uiselectitem(Item *entry) yankitem(&dir->items[item-1]); continue; case '/': - if (*sstr) + if (sstr && *sstr) searchinline(sstr, entry); continue; case 'h':