diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2015-07-18 23:29:51 +0100 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2015-07-18 23:30:15 +0100 |
commit | a470aacdb2e01b52d59ebe9575dda9e46c00d593 (patch) | |
tree | 3d11cbf58ed901bb682527e5345f8bdfa544e864 /riscos | |
parent | abc7a71117e4ae03f9b7146ce3f299a4b931b1ef (diff) | |
download | netsurf-a470aacdb2e01b52d59ebe9575dda9e46c00d593.tar.gz netsurf-a470aacdb2e01b52d59ebe9575dda9e46c00d593.tar.bz2 |
RISCOS: fix obvious NULL dereferences in URL complete.
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/gui/url_bar.c | 6 | ||||
-rw-r--r-- | riscos/url_complete.c | 9 |
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; + } } |