cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 40308b8b0bd7e15d0f6e2971b901a9c09a4bc681
parent 7619edcd116385414b55764a3401a0c66c04da79
Author: Callum Brown <callum@calcuode.com>
Date:   Tue,  6 Oct 2020 17:53:56 +0100

gmnlm: Fix segfault when local file does not exist

Diffstat:
Msrc/gmnlm.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -759,6 +759,13 @@ do_requests(struct browser *browser, struct gemini_response *resp) FILE *fp = fopen(path, "r"); if (!fp) { resp->status = GEMINI_STATUS_NOT_FOUND; + /* Make sure members of resp evaluate to false, so that + gemini_response_finish does not try to free them. */ + resp->bio = NULL; + resp->ssl = NULL; + resp->ssl_ctx = NULL; + resp->meta = NULL; + resp->fd = -1; free(path); break; }