summaryrefslogtreecommitdiff
path: root/lib/libedit/readline.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-14 13:36:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-11-14 13:36:38 +0000
commit8f371894198e0faf7c0e4edfc8378c95aff5aa03 (patch)
tree032915e13311479b04a0b897b6807fc0b40ebd45 /lib/libedit/readline.c
parent86f50091b2b5f2a1dc56f5baa97cec73dac1450a (diff)
use asprintf()
Diffstat (limited to 'lib/libedit/readline.c')
-rw-r--r--lib/libedit/readline.c7
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);
}