From 361fcf507a3591c97890091f1e906a2ee9402462 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Fri, 2 Apr 2004 15:16:15 +0000 Subject: [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 --- riscos/uri.c | 16 ++++++++-------- riscos/url_protocol.c | 27 ++++++++++++++------------- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'riscos') 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); } -- cgit v1.2.3