sacc

sacc(omys), simple console gopher client (mirror)
git clone https://git.parazyd.org/sacc
Log | Files | Refs | LICENSE

commit 74476b5fc0dff8d472e79c81c6a56ca1390fdf45
parent 45cf7e58579237078acd46c5e3139269e1105f66
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 13 Jul 2017 16:17:37 +0200

clearitem: prevent NULL dereference

Diffstat:
Msacc.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sacc.c b/sacc.c @@ -95,11 +95,14 @@ usage(void) static void clearitem(Item *item) { - Dir *dir = item->dat; + Dir *dir; Item **items; size_t i; - if (dir) { + if (!item) + return; + + if (dir = item->dat) { items = dir->items; for (i = 0; i < dir->nitems; ++i) { clearitem(items[i]);