Date: Mon, 12 Aug 2019 15:52:21 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350900 - stable/12/contrib/telnet/telnet Message-ID: <201908121552.x7CFqL5o055074@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Mon Aug 12 15:52:21 2019 New Revision: 350900 URL: https://svnweb.freebsd.org/changeset/base/350900 Log: MFC r350498: telnet: use asprintf for r350139 [MFC of r349890] change Sponsored by: The FreeBSD Foundation Modified: stable/12/contrib/telnet/telnet/commands.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/telnet/telnet/commands.c ============================================================================== --- stable/12/contrib/telnet/telnet/commands.c Mon Aug 12 12:51:47 2019 (r350899) +++ stable/12/contrib/telnet/telnet/commands.c Mon Aug 12 15:52:21 2019 (r350900) @@ -1655,14 +1655,11 @@ env_init(void) || (strncmp((char *)ep->value, "unix:", 5) == 0))) { char hbuf[256+1]; char *cp2 = strchr((char *)ep->value, ':'); - size_t buflen; gethostname(hbuf, sizeof(hbuf)); hbuf[sizeof(hbuf)-1] = '\0'; - buflen = strlen(hbuf) + strlen(cp2) + 1; - cp = (char *)malloc(sizeof(char)*buflen); + asprintf(&cp, "%s%s", hbuf, cp2); assert(cp != NULL); - snprintf((char *)cp, buflen, "%s%s", hbuf, cp2); free(ep->value); ep->value = (unsigned char *)cp; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908121552.x7CFqL5o055074>