cgmnlm

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

commit b298fadb216bfbac8c84e05363e508b3b3a314a5
parent 0eaf9cc109a99d6efb0d9c763291f6a5d9e74391
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 26 Sep 2020 16:59:06 -0400

Fix segfault on connection refused

Diffstat:
Msrc/client.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/client.c b/src/client.c @@ -94,8 +94,7 @@ gemini_request(const char *url, struct gemini_options *options, { assert(url); assert(resp); - resp->meta = NULL; - resp->bio = NULL; + memset(resp, 0, sizeof(*resp)); if (strlen(url) > 1024) { return GEMINI_ERR_INVALID_URL; } @@ -206,6 +205,7 @@ gemini_request(const char *url, struct gemini_options *options, } if (r < 3 || strcmp(&buf[r - 2], "\r\n") != 0) { + fprintf(stderr, "invalid line %d '%s'\n", r, buf); res = GEMINI_ERR_PROTOCOL; goto cleanup; } @@ -213,6 +213,7 @@ gemini_request(const char *url, struct gemini_options *options, char *endptr; resp->status = (enum gemini_status)strtol(buf, &endptr, 10); if (*endptr != ' ' || resp->status < 10 || resp->status >= 70) { + fprintf(stderr, "invalid status\n"); res = GEMINI_ERR_PROTOCOL; goto cleanup; }