diff options
author | 2005-11-14 13:36:37 +0000 | |
---|---|---|
committer | 2005-11-14 13:36:37 +0000 | |
commit | a9230d4e4bf7ce4beb91f740b78e94d4043ce1b1 (patch) | |
tree | 1efb53362bdd5bc4beface9455a73b21cd767141 /lib/libedit | |
parent | bus_size_t is a more proper type for a register offset [against bh] (diff) | |
download | wireguard-openbsd-a9230d4e4bf7ce4beb91f740b78e94d4043ce1b1.tar.xz wireguard-openbsd-a9230d4e4bf7ce4beb91f740b78e94d4043ce1b1.zip |
use asprintf()
Diffstat (limited to 'lib/libedit')
-rw-r--r-- | lib/libedit/readline.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index f0e52ec5b43..7d30c18bd35 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readline.c,v 1.2 2003/11/25 20:12:38 otto Exp $ */ +/* $OpenBSD: readline.c,v 1.3 2005/11/14 13:36:37 deraadt Exp $ */ /* $NetBSD: readline.c,v 1.43 2003/11/03 03:22:55 christos Exp $ */ /*- @@ -1403,11 +1403,8 @@ tilde_expand(char *txt) /* first slash */ txt += len; - len = strlen(pass->pw_dir) + 1 + strlen(txt) + 1; - temp = malloc(len); - if (temp == NULL) + if (asprintf(&temp, "%s/%s", pass->pw_dir, txt) == -1) return NULL; - (void)snprintf(temp, len, "%s/%s", pass->pw_dir, txt); return (temp); } |