From d3c9af5aa308105db11983ddc664b161df58e0ef Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Sun, 30 Mar 2003 21:10:27 +0000 Subject: [PATCH] more asprintf; millert ok --- src/lib/libutil/passwd.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/libutil/passwd.c b/src/lib/libutil/passwd.c index 38ae21e1..75d082c6 100644 --- a/src/lib/libutil/passwd.c +++ b/src/lib/libutil/passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: passwd.c,v 1.37 2003/03/30 20:57:59 deraadt Exp $ */ +/* $OpenBSD: passwd.c,v 1.38 2003/03/30 21:10:27 deraadt Exp $ */ /* * Copyright (c) 1987, 1993, 1994, 1995 @@ -34,7 +34,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$OpenBSD: passwd.c,v 1.37 2003/03/30 20:57:59 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: passwd.c,v 1.38 2003/03/30 21:10:27 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -394,10 +394,8 @@ pw_edit(notsetuid, filename) if ((editor = getenv("EDITOR")) == NULL) editor = _PATH_VI; - p = malloc(strlen(editor) + 1 + strlen(filename) + 1); - if (p == NULL) + if (asprintf(&p, "%s %s", editor, filename) == -1) return; - sprintf(p, "%s %s", editor, filename); argp[2] = p; switch (editpid = vfork()) {