Rename privoxy.1 to privoxy.8
[privoxy.git] / gateway.c
index b341ae9..135b217 100644 (file)
--- 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);