cgmnlm

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

commit 5d3ae7b7f52ba83428ba8d728712e8c1710b2ea0
parent d84ee77e249eae11c4b240294c6d37851f1ba11f
Author: Kevin Sangeelee <kevin@susa.net>
Date:   Tue, 29 Sep 2020 22:49:11 +0100

Init known_hosts prior to fopen to avoid segfault.

Diffstat:
Msrc/tofu.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/tofu.c b/src/tofu.c @@ -175,13 +175,14 @@ gemini_tofu_init(struct gemini_tofu *tofu, tofu->cb_data = cb_data; SSL_CTX_set_cert_verify_callback(ssl_ctx, verify_callback, tofu); + tofu->known_hosts = NULL; + FILE *f = fopen(tofu->known_hosts_path, "r"); if (!f) { return; } size_t n = 0; char *line = NULL; - tofu->known_hosts = NULL; while (getline(&line, &n, f) != -1) { struct known_host *host = calloc(1, sizeof(struct known_host)); char *tok = strtok(line, " ");