Recently Written · git

sacc

Mirror of git://bitreich.org/sacc, the sacc gopher client from bitreich.org.

git clone https://github.com/equwal/sacc

Log | Files | Refs


commit edb683070a46f17242618569dacff02b6075115e
Hiltjo Posthuma <hiltjo@codemadness.org>
2022-07-06 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!

 ui_txt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui_txt.c b/ui_txt.c
index 11e6378..e8f8bbe 100644
--- 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':