From 555122afdb95651d1f2b38e26d896a3dab6876cc Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 19 Apr 2014 12:36:03 +0000 Subject: [PATCH] malloc + strlcpy -> strdup --- lib/libssl/src/apps/s_socket.c | 5 ++--- 1 file 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) { -- 2.20.1