[hackers] [surf] Only plumb some URI, when it's ASCII. || Christoph Lohmann

From: <git_AT_suckless.org>
Date: Tue, 20 Jan 2015 17:38:50 +0100 (CET)

commit 344efec3fb932a9c5baae582fe70c72a0bc4a747
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Tue Jan 20 17:38:22 2015 +0100

    Only plumb some URI, when it's ASCII.

diff --git a/surf.c b/surf.c
index ce8fce8..ee4bfee 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -213,6 +213,7 @@ beforerequest(WebKitWebView *w, WebKitWebFrame *f, WebKitWebResource *r,
                 WebKitNetworkRequest *req, WebKitNetworkResponse *resp,
                 Client *c) {
         const gchar *uri = webkit_network_request_get_uri(req);
+ int i, isascii = 1;
 
         if(g_str_has_suffix(uri, "/favicon.ico"))
                 webkit_network_request_set_uri(req, "about:blank");
_AT_@ -224,7 +225,15 @@ beforerequest(WebKitWebView *w, WebKitWebFrame *f, WebKitWebResource *r,
                         && !g_str_has_prefix(uri, "data:") \
                         && !g_str_has_prefix(uri, "blob:") \
                         && strlen(uri) > 0) {
- handleplumb(c, w, uri);
+
+ for(i = 0; i < strlen(uri); i++) {
+ if(!g_ascii_isprint(uri[i])) {
+ isascii = 0;
+ break;
+ }
+ }
+ if(isascii)
+ handleplumb(c, w, uri);
         }
 }
 
Received on Tue Jan 20 2015 - 17:38:50 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 20 2015 - 17:48:15 CET