summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/irc/irc-server.c3
-rw-r--r--tests/unit/plugins/irc/test-irc-server.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 25f2077e3..ee248dec1 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -1726,6 +1726,9 @@ irc_server_alloc_with_url (const char *irc_url)
if (!irc_url || !irc_url[0])
return NULL;
+ if (weechat_strncasecmp (irc_url, "irc", 3) != 0)
+ return NULL;
+
irc_url2 = strdup (irc_url);
if (!irc_url2)
return NULL;
diff --git a/tests/unit/plugins/irc/test-irc-server.cpp b/tests/unit/plugins/irc/test-irc-server.cpp
index 506ba4266..2727c47c8 100644
--- a/tests/unit/plugins/irc/test-irc-server.cpp
+++ b/tests/unit/plugins/irc/test-irc-server.cpp
@@ -534,8 +534,8 @@ TEST(IrcServer, AllocWithUrl)
POINTERS_EQUAL(NULL, irc_server_alloc_with_url (NULL));
POINTERS_EQUAL(NULL, irc_server_alloc_with_url (""));
-
POINTERS_EQUAL(NULL, irc_server_alloc_with_url ("test"));
+ POINTERS_EQUAL(NULL, irc_server_alloc_with_url ("test://irc.example.org"));
/* address */
server = irc_server_alloc_with_url ("irc://irc.example.org");