From 7d6c478c9c0d1cc0ec9cc44e7c5fd49c5772d6d2 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Fri, 29 Mar 2024 14:13:32 -0400 Subject: [PATCH] fix off by one error when adding https:// to url --- rosenrot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rosenrot.c b/rosenrot.c index 64909ce..47a26c0 100644 --- 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