summaryrefslogtreecommitdiff
path: root/src/yuzu/applets/web_browser.h
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-04-28 11:32:44 -0400
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-04-28 12:34:28 -0400
commit0af182baa2f35d91b8dfaf0b5a8fef06b77dd03a (patch)
treee38c0517595bffd75e5b3df06084fce8531c48f1 /src/yuzu/applets/web_browser.h
parentb096ec68cdbf6f1064a8b6b855489d38c3e59f6a (diff)
applets/web: Fix a use-after-free when passing in the URL string
The URL string was being deleted before being used, leading to a use-after-free occurring when it is used afterwards. Fix this by taking the string by const ref to extend its lifetime, ensuring it doesn't get deleted before use.
Diffstat (limited to 'src/yuzu/applets/web_browser.h')
-rw-r--r--src/yuzu/applets/web_browser.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h
index 47f960d69..7ad07409f 100644
--- a/src/yuzu/applets/web_browser.h
+++ b/src/yuzu/applets/web_browser.h
@@ -58,7 +58,7 @@ public:
* @param main_url The url to the file.
* @param additional_args Additional arguments appended to the main url.
*/
- void LoadLocalWebPage(std::string_view main_url, std::string_view additional_args);
+ void LoadLocalWebPage(const std::string& main_url, const std::string& additional_args);
/**
* Loads an external website. Cannot be used to load local urls.
@@ -66,7 +66,7 @@ public:
* @param main_url The url to the website.
* @param additional_args Additional arguments appended to the main url.
*/
- void LoadExternalWebPage(std::string_view main_url, std::string_view additional_args);
+ void LoadExternalWebPage(const std::string& main_url, const std::string& additional_args);
/**
* Sets the background color of the web page.
@@ -193,16 +193,17 @@ public:
explicit QtWebBrowser(GMainWindow& parent);
~QtWebBrowser() override;
- void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback_,
+ void OpenLocalWebPage(const std::string& local_url,
+ std::function<void()> extract_romfs_callback_,
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
callback_) const override;
- void OpenExternalWebPage(std::string_view external_url,
+ void OpenExternalWebPage(const std::string& external_url,
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
callback_) const override;
signals:
- void MainWindowOpenWebPage(std::string_view main_url, std::string_view additional_args,
+ void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args,
bool is_local) const;
private: