socks5_connect: Fix compiler warning from GCC9 with -D_FORTIFY_SOURCE=2
authorFabian Keil <fk@fabiankeil.de>
Sat, 5 Dec 2020 13:12:25 +0000 (14:12 +0100)
committerFabian Keil <fk@fabiankeil.de>
Mon, 7 Dec 2020 15:01:33 +0000 (16:01 +0100)
commitb402d02197854c83609bb59de1365b1136703d8a
tree8261b8cb2c897dad14db3df618a1b1bd966daff8
parente15357d347c1c3b52a482430d87689ab5a76d5a1
socks5_connect: Fix compiler warning from GCC9 with -D_FORTIFY_SOURCE=2

    gateway.c: In function 'socks5_connect':
    gateway.c:1249:4: warning: 'strncpy' specified bound 295 equals destination size [-Wstringop-truncation]
     1249 |    strncpy(cbuf + client_pos, target_host, sizeof(cbuf) - client_pos);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The warning is harmless because 'target_host' is checked to
be at most 255 bytes long.

Reported by Lee.
gateway.c