From 0a230bae6515ac43e29b132241e5dde95b422155 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Thu, 21 Feb 2019 00:15:09 -0500 Subject: [PATCH] Fixed issue in _webTLVWrite. Updated web docs. The url param for webPageCreate is no longer optional. --- nx/include/switch/applets/web.h | 4 ++-- nx/source/applets/web.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nx/include/switch/applets/web.h b/nx/include/switch/applets/web.h index f55e37db..258b3d03 100644 --- a/nx/include/switch/applets/web.h +++ b/nx/include/switch/applets/web.h @@ -77,9 +77,9 @@ void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out); /** - * @brief Creates the config for WebApplet. + * @brief Creates the config for WebApplet. This applet uses an URL whitelist loaded from the user-process host title. * @param config WebPageConfig object. - * @param url Optional initial URL navigated to by the applet, can be NULL. + * @param url Initial URL navigated to by the applet. */ void webPageCreate(WebPageConfig* config, const char* url); diff --git a/nx/source/applets/web.c b/nx/source/applets/web.c index 6ab418af..f9675cf1 100644 --- a/nx/source/applets/web.c +++ b/nx/source/applets/web.c @@ -90,6 +90,8 @@ static void _webTLVWrite(void* buffer, size_t size, u16 type, const void* argdat if (size < offset + sizeof(WebArgTLV) + argdata_size) return; + tlv = (WebArgTLV*)&dataptr[offset]; + if (tlv->type != type) { tlv->type = type; tlv->size = argdata_size; @@ -124,11 +126,9 @@ void webPageCreate(WebPageConfig* config, const char* url) { u8 tmpval=1; _webTLVWrite(config->arg, sizeof(config->arg), 0x12, &tmpval, sizeof(tmpval)); /// Type was changed to 0xD with a newer version. - if (url) { - memset(tmpurl, 0, sizeof(tmpurl)); - strncpy(tmpurl, url, sizeof(tmpurl)-1); - _webTLVWrite(config->arg, sizeof(config->arg), 0x1, tmpurl, sizeof(tmpurl)); - } + memset(tmpurl, 0, sizeof(tmpurl)); + strncpy(tmpurl, url, sizeof(tmpurl)-1); + _webTLVWrite(config->arg, sizeof(config->arg), 0x1, tmpurl, sizeof(tmpurl)); } Result webPageShow(WebPageConfig* config, WebPageReturnValue *out) {