[hackers] [surf] setcert: check uri before adding a certificate || Hiltjo Posthuma
commit edddfbc14ac3a4413f38171e8fd7767ae56e27bf
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Sat Apr 29 22:16:03 2017 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Sun Apr 30 11:39:15 2017 +0200
setcert: check uri before adding a certificate
Also directly check for https scheme, we won't need a certificate for
others.
diff --git a/surf.c b/surf.c
index d67d09b..785fa0d 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -792,14 +792,16 @@ setcert(Client *c, const char *uri)
return;
}
- uri = strstr(uri, "://") + sizeof("://") - 1;
- host = strndup(uri, strstr(uri, "/") - uri);
+ if ((uri = strstr(uri, "https://"))) {
+ uri += sizeof("https://") - 1;
+ host = g_strndup(uri, strchr(uri, '/') - uri);
+ webkit_web_context_allow_tls_certificate_for_host(
+ webkit_web_view_get_context(c->view), cert, host);
+ g_free(host);
+ }
- webkit_web_context_allow_tls_certificate_for_host(
- webkit_web_view_get_context(c->view), cert, host);
g_object_unref(cert);
- free(host);
}
const char *
Received on Sun Apr 30 2017 - 23:25:12 CEST
This archive was generated by hypermail 2.3.0
: Sun Apr 30 2017 - 23:37:13 CEST