diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2018-07-17 21:55:33 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2018-07-17 21:55:33 +0200 |
commit | 3a580d35a07ed35c4c69173db486049a16949895 (patch) | |
tree | 6ae8a29dfe4bdb1191264f12f1fb403d73ae01ba /doc | |
parent | 2df30777385f2abeded3040d5d188c531779621f (diff) | |
download | gnutls-3a580d35a07ed35c4c69173db486049a16949895.tar.gz |
examples: tlsproxy: use snprintf instead of strncpy
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'doc')
-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 */ |