summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2012-09-27 12:26:36 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2012-09-27 12:26:36 +0000
commitb138fb02aacdfada51468ff81d3adc2904b93fcf (patch)
tree0c93b3e826248fb0e2ac1d3380d4ab979ef32533 /usr.sbin/smtpd
parenta65e01e29d45a80629a699dc37645f4c8c41e955 (diff)
simplify malloc() + strlcpy() dance with xstrdup()
ok gilles@ eric@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/enqueue.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c
index 6e5cf24aab1..2fa1190ddf8 100644
--- a/usr.sbin/smtpd/enqueue.c
+++ b/usr.sbin/smtpd/enqueue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enqueue.c,v 1.61 2012/08/23 16:10:19 todd Exp $ */
+/* $OpenBSD: enqueue.c,v 1.62 2012/09/27 12:26:35 chl Exp $ */
/*
* Copyright (c) 2005 Henning Brauer <henning@bulabula.org>
@@ -428,9 +428,7 @@ build_from(char *fake_from, struct passwd *pw)
if (fake_from[strlen(fake_from) - 1] != '>')
errx(1, "leading < but no trailing >");
fake_from[strlen(fake_from) - 1] = 0;
- if ((p = malloc(strlen(fake_from))) == NULL)
- err(1, "malloc");
- strlcpy(p, fake_from + 1, strlen(fake_from));
+ p = xstrdup(fake_from + 1, "build_from");
msg.from = qualify_addr(p);
free(p);