commit 7d6c478c9c0d1cc0ec9cc44e7c5fd49c5772d6d2
parent 9cb8bd5818c566de8e482abee6752006a490891b
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date: Fri, 29 Mar 2024 14:13:32 -0400
fix off by one error when adding https:// to url
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rosenrot.c b/rosenrot.c
@@ -37,8 +37,8 @@ void load_uri(WebKitWebView* view, const char* uri)
} else if (g_str_has_prefix(uri, "http://") || g_str_has_prefix(uri, "https://") || g_str_has_prefix(uri, "file://") || g_str_has_prefix(uri, "about:")) {
webkit_web_view_load_uri(view, uri);
} else if (strstr(uri, ".com") || strstr(uri, ".org")) {
- char tmp[strlen("https://") + strlen(uri)];
- snprintf(tmp, sizeof(tmp), "https://%s", uri);
+ char tmp[strlen("https://") + strlen(uri) + 1];
+ snprintf(tmp, sizeof(tmp) + 1, "https://%s", uri);
webkit_web_view_load_uri(view, tmp);
} else {
// Check for shortcuts