summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
Diffstat (limited to 'riscos')
-rw-r--r--riscos/gui/url_bar.c6
-rw-r--r--riscos/url_complete.c9
2 files changed, 10 insertions, 5 deletions
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c
index a25ea8748..d910b7592 100644
--- a/riscos/gui/url_bar.c
+++ b/riscos/gui/url_bar.c
@@ -178,7 +178,11 @@ struct url_bar *ro_gui_url_bar_create(struct theme_descriptor *theme)
url_bar->text_size = RO_GUI_MAX_URL_SIZE;
url_bar->text_buffer = malloc(url_bar->text_size);
- strncpy(url_bar->text_buffer, "", url_bar->text_size);
+ if (url_bar->text_buffer == NULL) {
+ free(url_bar);
+ return NULL;
+ }
+ url_bar->text_buffer[0] = 0;
url_bar->hidden = false;
diff --git a/riscos/url_complete.c b/riscos/url_complete.c
index 3d189a01d..ff91b1c18 100644
--- a/riscos/url_complete.c
+++ b/riscos/url_complete.c
@@ -85,10 +85,11 @@ void ro_gui_url_complete_start(struct toolbar *toolbar)
ro_gui_url_complete_close();
url = ro_toolbar_get_url(toolbar);
-
- url_complete_matched_string = strdup(url);
- if (url_complete_matched_string)
- url_complete_parent = parent;
+ if (url != NULL) {
+ url_complete_matched_string = strdup(url);
+ if (url_complete_matched_string)
+ url_complete_parent = parent;
+ }
}