diff options
author | 2014-04-19 12:36:03 +0000 | |
---|---|---|
committer | 2014-04-19 12:36:03 +0000 | |
commit | 555122afdb95651d1f2b38e26d896a3dab6876cc (patch) | |
tree | f7a0cff7f9fd1dae086bc7c89d304a4b2beb3b69 /lib/libssl/src | |
parent | (void) cast strlcpy(), it cannot truncate (diff) | |
download | wireguard-openbsd-555122afdb95651d1f2b38e26d896a3dab6876cc.tar.xz wireguard-openbsd-555122afdb95651d1f2b38e26d896a3dab6876cc.zip |
malloc + strlcpy -> strdup
Diffstat (limited to 'lib/libssl/src')
-rw-r--r-- | lib/libssl/src/apps/s_socket.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/libssl/src/apps/s_socket.c b/lib/libssl/src/apps/s_socket.c index 57015ed8ffc..d52714c8c7f 100644 --- a/lib/libssl/src/apps/s_socket.c +++ b/lib/libssl/src/apps/s_socket.c @@ -302,11 +302,10 @@ redoit: *host = NULL; /* return(0); */ } else { - if ((*host = (char *) malloc(strlen(h1->h_name) + 1)) == NULL) { - perror("malloc"); + if ((*host = strdup(h1->h_name) == NULL) { + perror("strdup"); return (0); } - strlcpy(*host, h1->h_name, strlen(h1->h_name) + 1); h2 = GetHostByName(*host); if (h2 == NULL) { |