1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Fix off-by-one

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel 2022-02-01 17:41:19 +01:00
parent ad87bdffc2
commit 569525c6c7

View File

@ -935,7 +935,7 @@ _split_url(const char* alturi, gchar** host, gint* port)
char* last = strrchr(alturi, ':');
if (first) {
if (first == last) {
hostlen = last - alturi;
hostlen = last - alturi + 1;
if (!strtoi_range(last + 1, port, 1, 65535, NULL))
return FALSE;
} else {
@ -949,7 +949,7 @@ _split_url(const char* alturi, gchar** host, gint* port)
*port = 0;
} else {
/* `[ip:v6]:port` */
hostlen = last - alturi;
hostlen = last - alturi + 1;
if (!strtoi_range(last + 1, port, 1, 65535, NULL))
return FALSE;
}