commit 51ae22db181118e8f4c6450ec6e7c8344651c75b
parent dbb3153c5c90a23777415ad4a72aab54ce564e80
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Sun, 10 Jun 2018 23:09:18 +0200
Fixed an off-by-one buffer overflow in proxy.c.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/common/proxy.c b/src/common/proxy.c
@@ -257,7 +257,7 @@ gint socks5_connect(SockInfo *sock, const gchar *hostname, gushort port,
} else if (socks_req[3] == 3) { /* Domain name */
gint hnlen = socks_req[4];
gchar *hn = malloc(hnlen + 1);
- hn[hnlen + 1] = '\0';
+ hn[hnlen] = '\0';
memcpy(hn, &socks_req[5], hnlen);
g_warning("socks5_connect: SOCKS5 connection to %s:%u failed. (%u)",
hn, ntohs(*(gushort *)(socks_req + 5 + hnlen)), socks_req[1]);
@@ -265,7 +265,7 @@ gint socks5_connect(SockInfo *sock, const gchar *hostname, gushort port,
} else if (socks_req[3] == 4) { /* IPv6 address */
gint hnlen = 16;
gchar *hn = malloc(hnlen + 1);
- hn[hnlen + 1] = '\0';
+ hn[hnlen] = '\0';
memcpy(hn, &socks_req[4], hnlen);
g_warning("socks5_connect: SOCKS5 connection to IPv6 %s:%u failed. (%u)",
hn, ntohs(*(gushort *)(socks_req + 5 + hnlen)), socks_req[1]);