| Date: Sun, 27 Oct 2024 15:50:08 +0100
Fix handling of invalid items in yankitem and delve
An invalid item contains zeroes in all fields other than username.
That lead to an segmentation fault in itemuri. Additionally NULL strings
would have been printed in delve.
Error was observed on gopher://gopher.someodd.zip/1/phorum ( "mirror" of
erroneous content hosted at
gopher://gopher.0xfa.de/1/pazz0/p/someodd_phorum ).
Diffstat:
M sacc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- |
| @@ -798,6 +798,9 @@ cleanup:
void
yankitem(Item *item)
{
+ if (item->type == 0)
+ return;
+
itemuri(item, intbuf, sizeof(intbuf));
pipeuri(yanker, "Yanked", intbuf);
}
@@ -969,8 +972,7 @@ delve(Item *hole)
entry = hole;
break;
case 0:
- diag("Couldn't get %s:%s/%c%s", hole->host,
- hole->port, hole->type, hole->selector);
+ diag("Couldn't get %s", hole->username);
break;
case '4':
case '5': |