diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-10-06 08:51:36 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2015-10-06 08:51:36 +0000 |
commit | 563d286257c090b0365591edd9a9a4df6383d817 (patch) | |
tree | 9281b9b4ca8bc2b3684ecc9824ea30195b96a6f2 /usr.sbin/smtpd/smtpd.c | |
parent | 5f9f2fbec4e279e1270a2d73c38efeab4c7f6512 (diff) |
we don't need this temporary buffer since we're going to strdup() it right
away anyways
ok eric@
Diffstat (limited to 'usr.sbin/smtpd/smtpd.c')
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index abc3856ee84..0efe70716d9 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.241 2015/10/06 06:04:46 gilles Exp $ */ +/* $OpenBSD: smtpd.c,v 1.242 2015/10/06 08:51:35 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -1048,19 +1048,22 @@ offline_scan(int fd, short ev, void *arg) static int offline_enqueue(char *name) { - char t[PATH_MAX], *path; + char *path; struct stat sb; pid_t pid; struct child *child; struct passwd *pw; + int pathlen; - if (!bsnprintf(t, sizeof t, "%s/%s", PATH_SPOOL PATH_OFFLINE, name)) { - log_warnx("warn: smtpd: path name too long"); + pathlen = asprintf(&path, "%s/%s", PATH_SPOOL PATH_OFFLINE, name); + if (pathlen == -1) { + log_warnx("warn: smtpd: asprintf"); return (-1); } - if ((path = strdup(t)) == NULL) { - log_warn("warn: smtpd: strdup"); + if (pathlen >= PATH_MAX) { + log_warnx("warn: smtpd: pathname exceeds PATH_MAX"); + free(path); return (-1); } |