Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/a3c3b2fa976a0679b40c85c3afb89e66cd8d1bfb
...commit
http://git.netsurf-browser.org/netsurf.git/commit/a3c3b2fa976a0679b40c85c3afb89e66cd8d1bfb
...tree
http://git.netsurf-browser.org/netsurf.git/tree/a3c3b2fa976a0679b40c85c3afb89e66cd8d1bfb
The branch, master has been updated
via a3c3b2fa976a0679b40c85c3afb89e66cd8d1bfb (commit)
from ef75d670d6537ac1bdf46c363843e801005907b2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=a3c3b2fa976a0679b40c85c3afb89e66cd8d1bfb
commit a3c3b2fa976a0679b40c85c3afb89e66cd8d1bfb
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
make internal url navigation check safe
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index a6d3ae9..acefc78 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -2302,6 +2302,40 @@ browser_window_drop_file_at_point_internal(struct
browser_window *bw,
}
+/**
+ * Check if this is an internal navigation URL.
+ *
+ * This safely checks if the given url is an internal navigation even
+ * for urls with no scheme or path.
+ *
+ * \param url The URL to check
+ * \return true if an internal navigation url else false
+ */
+static bool
+is_internal_navigate_url(nsurl *url)
+{
+ bool is_internal = false;
+ lwc_string *scheme, *path;
+
+ scheme = nsurl_get_component(url, NSURL_SCHEME);
+ if (scheme != NULL) {
+ path = nsurl_get_component(url, NSURL_PATH);
+ if (path != NULL) {
+ if (scheme == corestring_lwc_about) {
+ if (path == corestring_lwc_query_auth) {
+ is_internal = true;
+ } else if (path == corestring_lwc_query_ssl) {
+ is_internal = true;
+ }
+ }
+ lwc_string_unref(path);
+ }
+ lwc_string_unref(scheme);
+ }
+ return is_internal;
+}
+
+
/* exported interface, documented in netsurf/browser_window.h */
nserror
browser_window_get_name(struct browser_window *bw, const char **out_name)
@@ -3050,27 +3084,17 @@ browser_window_navigate(struct browser_window *bw,
nserror error;
bool is_internal = false;
struct browser_fetch_parameters params, *pass_params = NULL;
- lwc_string *scheme, *path;
assert(bw);
assert(url);
NSLOG(netsurf, INFO, "bw %p, url %s", bw, nsurl_access(url));
- /* Check if this is an internal navigation URL, if so, we do not
- * do certain things during the load
+ /*
+ * determine if navigation is internal url, if so, we do not
+ * do certain things during the load.
*/
- scheme = nsurl_get_component(url, NSURL_SCHEME);
- path = nsurl_get_component(url, NSURL_PATH);
- if (scheme == corestring_lwc_about) {
- if (path == corestring_lwc_query_auth) {
- is_internal = true;
- } else if (path == corestring_lwc_query_ssl) {
- is_internal = true;
- }
- }
- lwc_string_unref(scheme);
- lwc_string_unref(path);
+ is_internal = is_internal_navigate_url(url);
if (is_internal &&
!(flags & BW_NAVIGATE_INTERNAL)) {
-----------------------------------------------------------------------
Summary of changes:
desktop/browser_window.c | 52 +++++++++++++++++++++++++++++++++-------------
1 file changed, 38 insertions(+), 14 deletions(-)
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index a6d3ae9..acefc78 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -2302,6 +2302,40 @@ browser_window_drop_file_at_point_internal(struct
browser_window *bw,
}
+/**
+ * Check if this is an internal navigation URL.
+ *
+ * This safely checks if the given url is an internal navigation even
+ * for urls with no scheme or path.
+ *
+ * \param url The URL to check
+ * \return true if an internal navigation url else false
+ */
+static bool
+is_internal_navigate_url(nsurl *url)
+{
+ bool is_internal = false;
+ lwc_string *scheme, *path;
+
+ scheme = nsurl_get_component(url, NSURL_SCHEME);
+ if (scheme != NULL) {
+ path = nsurl_get_component(url, NSURL_PATH);
+ if (path != NULL) {
+ if (scheme == corestring_lwc_about) {
+ if (path == corestring_lwc_query_auth) {
+ is_internal = true;
+ } else if (path == corestring_lwc_query_ssl) {
+ is_internal = true;
+ }
+ }
+ lwc_string_unref(path);
+ }
+ lwc_string_unref(scheme);
+ }
+ return is_internal;
+}
+
+
/* exported interface, documented in netsurf/browser_window.h */
nserror
browser_window_get_name(struct browser_window *bw, const char **out_name)
@@ -3050,27 +3084,17 @@ browser_window_navigate(struct browser_window *bw,
nserror error;
bool is_internal = false;
struct browser_fetch_parameters params, *pass_params = NULL;
- lwc_string *scheme, *path;
assert(bw);
assert(url);
NSLOG(netsurf, INFO, "bw %p, url %s", bw, nsurl_access(url));
- /* Check if this is an internal navigation URL, if so, we do not
- * do certain things during the load
+ /*
+ * determine if navigation is internal url, if so, we do not
+ * do certain things during the load.
*/
- scheme = nsurl_get_component(url, NSURL_SCHEME);
- path = nsurl_get_component(url, NSURL_PATH);
- if (scheme == corestring_lwc_about) {
- if (path == corestring_lwc_query_auth) {
- is_internal = true;
- } else if (path == corestring_lwc_query_ssl) {
- is_internal = true;
- }
- }
- lwc_string_unref(scheme);
- lwc_string_unref(path);
+ is_internal = is_internal_navigate_url(url);
if (is_internal &&
!(flags & BW_NAVIGATE_INTERNAL)) {
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org