From: deraadt Date: Sat, 19 Apr 2014 12:36:03 +0000 (+0000) Subject: malloc + strlcpy -> strdup X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=555122afdb95651d1f2b38e26d896a3dab6876cc;p=openbsd malloc + strlcpy -> strdup --- 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) {