commit cc6a6881e06ab4b851c7778842374b953e51539c Julian Schweinsberg <pazz0@0xfa.de> 2024-10-27 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 ).
sacc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sacc.c b/sacc.c index 700d4ec..45fb0d6 100644 --- a/sacc.c +++ b/sacc.c @@ -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':