svn commit: r350498 - head/contrib/telnet/telnet
Ed Maste
emaste at FreeBSD.org
Thu Aug 1 13:46:04 UTC 2019
Author: emaste
Date: Thu Aug 1 13:46:04 2019
New Revision: 350498
URL: https://svnweb.freebsd.org/changeset/base/350498
Log:
telnet: use asprintf for r349890 change
Suggested by: imp
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Modified:
head/contrib/telnet/telnet/commands.c
Modified: head/contrib/telnet/telnet/commands.c
==============================================================================
--- head/contrib/telnet/telnet/commands.c Thu Aug 1 13:42:58 2019 (r350497)
+++ head/contrib/telnet/telnet/commands.c Thu Aug 1 13:46:04 2019 (r350498)
@@ -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;
}
More information about the svn-src-all
mailing list