talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit a6d7f318ac05f98e4905aec1d189145faaa73c9c
parent 35fb89950dda7cc124f5ca3dec5d34dd54c29b0b
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:
Msrc/common/proxy.c | 4++--
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]);