diff options
author | Charles Longeau <chl@cvs.openbsd.org> | 2012-09-29 22:16:47 +0000 |
---|---|---|
committer | Charles Longeau <chl@cvs.openbsd.org> | 2012-09-29 22:16:47 +0000 |
commit | 19f538673ee58961595adf783f89c86f9952ae30 (patch) | |
tree | e31c967c5f44afdbec146ab97d1932b9dac3f2a9 /usr.sbin | |
parent | 72a208d080c4c3761afbd99aded4d0660f098f55 (diff) |
use xstrdup() helper
ok eric@ gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/smtp.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c index 5ae5050dbf1..6b9d75c5100 100644 --- a/usr.sbin/smtpd/smtp.c +++ b/usr.sbin/smtpd/smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp.c,v 1.116 2012/09/19 18:20:36 eric Exp $ */ +/* $OpenBSD: smtp.c,v 1.117 2012/09/29 22:16:46 chl Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -181,27 +181,20 @@ smtp_imsg(struct imsgev *iev, struct imsg *imsg) if (ssl == NULL) fatal(NULL); *ssl = *(struct ssl *)imsg->data; - ssl->ssl_cert = strdup((char *)imsg->data + - sizeof *ssl); - if (ssl->ssl_cert == NULL) - fatal(NULL); - ssl->ssl_key = strdup((char *)imsg->data + sizeof *ssl + - ssl->ssl_cert_len); - if (ssl->ssl_key == NULL) - fatal(NULL); + ssl->ssl_cert = xstrdup((char *)imsg->data + + sizeof *ssl, "smtp:ssl_cert"); + ssl->ssl_key = xstrdup((char *)imsg->data + sizeof *ssl + + ssl->ssl_cert_len, "smtp:ssl_key"); if (ssl->ssl_dhparams_len) { - ssl->ssl_dhparams = strdup((char *)imsg->data + ssl->ssl_dhparams = xstrdup((char *)imsg->data + sizeof *ssl + ssl->ssl_cert_len + - ssl->ssl_key_len); - if (ssl->ssl_dhparams == NULL) - fatal(NULL); + ssl->ssl_key_len, "smtp:ssl_dhparams"); } if (ssl->ssl_ca_len) { - ssl->ssl_ca = strdup((char *)imsg->data + ssl->ssl_ca = xstrdup((char *)imsg->data + sizeof *ssl + ssl->ssl_cert_len + - ssl->ssl_key_len + ssl->ssl_dhparams_len); - if (ssl->ssl_ca == NULL) - fatal(NULL); + ssl->ssl_key_len + ssl->ssl_dhparams_len, + "smtp:ssl_ca"); } SPLAY_INSERT(ssltree, env->sc_ssl, ssl); |