diff options
Diffstat (limited to 'doc/examples/tlsproxy/tlsproxy.c')
-rw-r--r-- | doc/examples/tlsproxy/tlsproxy.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/doc/examples/tlsproxy/tlsproxy.c b/doc/examples/tlsproxy/tlsproxy.c index 0257b943d1..9404d875ef 100644 --- a/doc/examples/tlsproxy/tlsproxy.c +++ b/doc/examples/tlsproxy/tlsproxy.c @@ -62,8 +62,7 @@ bindtoaddress (char *addrport) int fd, s; char addr[128]; - strncpy(addr, addrport, sizeof(addr)-1); - addr[sizeof(addr)-1] = 0; + snprintf(addr, sizeof(addr), "%s", addrport); memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ @@ -132,8 +131,7 @@ connecttoaddress (char *addrport) int fd, s; char addr[128]; - strncpy(addr, addrport, sizeof(addr)-1); - addr[sizeof(addr)-1] = 0; + snprintf(addr, sizeof(addr), "%s", addrport); memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */ |