summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-04-02 15:16:15 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-04-02 15:16:15 +0000
commit361fcf507a3591c97890091f1e906a2ee9402462 (patch)
tree1b5c34c1da558c7c2791282b1aec509015e1a083 /riscos
parent20454498ed6dd9cb3361fc8cece0319d789dd62e (diff)
downloadnetsurf-361fcf507a3591c97890091f1e906a2ee9402462.tar.gz
netsurf-361fcf507a3591c97890091f1e906a2ee9402462.tar.bz2
[project @ 2004-04-02 15:16:15 by jmb]
Update url checking to use fetch_can_fetch Fix non null-termination of strings in URL broadcast messages. svn path=/import/netsurf/; revision=701
Diffstat (limited to 'riscos')
-rw-r--r--riscos/uri.c16
-rw-r--r--riscos/url_protocol.c27
2 files changed, 22 insertions, 21 deletions
diff --git a/riscos/uri.c b/riscos/uri.c
index 4e0205391..d513af8c6 100644
--- a/riscos/uri.c
+++ b/riscos/uri.c
@@ -74,13 +74,13 @@ bool ro_uri_launch(char *uri) {
wimp_t handle_task;
uri_dispatch_flags returned;
os_error *e;
-
+
e = xuri_dispatch(0, uri, task_handle, &returned, &handle_task, &uri_handle);
-
+
if (e || returned & 1) {
return false;
}
-
+
return true;
}
@@ -88,15 +88,15 @@ void ro_uri_bounce(uri_full_message_return_result *message) {
char uri_buf[512];
os_error *e;
-
+
if ((message->flags & 1) == 0) return;
-
+
e = xuri_request_uri(0, uri_buf, sizeof uri_buf, message->handle, 0);
-
+
if (e) return;
-
+
ro_url_load(uri_buf);
-
+
return;
}
#endif
diff --git a/riscos/url_protocol.c b/riscos/url_protocol.c
index e1b32e691..b24e68401 100644
--- a/riscos/url_protocol.c
+++ b/riscos/url_protocol.c
@@ -131,20 +131,21 @@ bool ro_url_broadcast(char *url) {
inetsuite_full_message_open_url_direct message;
os_error *e;
- int len = (strlen(url)>235) ? 235 : strlen(url);
-
- message.size = (((20+len-1)+3) & ~3);
+ int len = ((strlen(url)+1)>235) ? 235 : strlen(url)+1;
+
+ message.size = ((20+len+3) & ~3);
message.your_ref = 0;
message.action = message_INET_SUITE_OPEN_URL;
-
+
*message.url = 0;
strncat(message.url, url, 235);
- e = xwimp_send_message(wimp_USER_MESSAGE_RECORDED,
+ message.url[len-1] = 0;
+ e = xwimp_send_message(wimp_USER_MESSAGE_RECORDED,
(wimp_message*)&message, 0);
if (e) {
return false;
}
-
+
return true;
}
@@ -153,30 +154,30 @@ bool ro_url_load(char *url) {
char url_buf[512];
char *colon;
os_error *e;
-
+
colon = strchr(url, ':');
if (!colon) return false;
-
+
strcpy(url_buf, "Alias$URLOpen_");
strncat(url_buf, url, colon-url);
if (!getenv(url_buf)) return false;
-
+
strcat(url_buf, " ");
strncat(url_buf, url, 512-strlen(url_buf)-1);
-
+
e = xwimp_start_task(url_buf+5, 0);
-
+
if (e) {
return false;
}
-
+
return true;
}
void ro_url_bounce(wimp_message *message) {
inetsuite_message_open_url *url_message = (inetsuite_message_open_url*)&message->data;
-
+
/* ant broadcast bounced -> try uri broadcast / load */
ro_uri_launch(url_message->url);
}