X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=gateway.c;h=135b217344cfadea2e51e9d7f9c7c85e55412789;hp=b341ae95ce2644e8b802c2b16c26e0d10242fd64;hb=66b1e23830d60ea98b0ba2ac5644ef24a45f9c55;hpb=c83713758e9465e03ec3b0228c433e6f2d843352 diff --git a/gateway.c b/gateway.c index b341ae95..135b2173 100644 --- a/gateway.c +++ b/gateway.c @@ -1246,7 +1246,7 @@ static jb_socket socks5_connect(const struct forward_spec *fwd, cbuf[client_pos++] = (char)(hostlen & 0xffu); assert(sizeof(cbuf) - client_pos > (size_t)255); /* Using strncpy because we really want the nul byte padding. */ - strncpy(cbuf + client_pos, target_host, sizeof(cbuf) - client_pos); + strncpy(cbuf + client_pos, target_host, sizeof(cbuf) - client_pos - 1); client_pos += (hostlen & 0xffu); cbuf[client_pos++] = (char)((target_port >> 8) & 0xff); cbuf[client_pos++] = (char)((target_port ) & 0xff);