diff options
author | Ed Maste <emaste@FreeBSD.org> | 2019-08-12 15:52:21 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2019-08-12 15:52:21 +0000 |
commit | 2ba3adab60f20b2ada706386a314d3d02c06438e (patch) | |
tree | ff212ff2136cc66c1c786b3f0967ce4509603357 | |
parent | b4f4af5d53f777dae491267e409a367d2ede2531 (diff) | |
download | src-test2-2ba3adab60f20b2ada706386a314d3d02c06438e.tar.gz src-test2-2ba3adab60f20b2ada706386a314d3d02c06438e.zip |
Notes
-rw-r--r-- | contrib/telnet/telnet/commands.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/contrib/telnet/telnet/commands.c b/contrib/telnet/telnet/commands.c index c6dc4ca064b7..8b7c6595b906 100644 --- a/contrib/telnet/telnet/commands.c +++ b/contrib/telnet/telnet/commands.c @@ -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; } |