Fix probable NULL dereference

This commit is contained in:
styan 2020-04-30 01:32:02 +00:00
parent 44790d35ba
commit df1d8b0518
1 changed files with 2 additions and 2 deletions

View File

@ -187,9 +187,9 @@ gemini_open(struct gemini *g, const char *url)
warnx("TLS Error: %s", tls_error(g->tls));
goto err;
}
if ((hash = tls_peer_cert_hash(g->tls)) == NULL)
goto err;
if (g->tofufile != NULL) {
if ((hash = tls_peer_cert_hash(g->tls)) == NULL)
goto err;
if (g->tofufd < 0 && (g->tofufd = open(g->tofufile,
((g->flags & GEMINI_TOFU_WRITE) ?
(O_RDWR | O_CREAT) : O_RDONLY) |