diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-09 02:38:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-09 02:38:57 +0000 |
commit | 1b5e01e6feef83f5fd37ee22fd37e5756bccee91 (patch) | |
tree | 7914feb6f5a89b188c315c3fdfb8ea66dce4c39c /sbin/isakmpd | |
parent | e172342424cf0defab931710f25c464e0b7b5023 (diff) |
obvious reallocarray() conversions
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/ike_quick_mode.c | 22 | ||||
-rw-r--r-- | sbin/isakmpd/ipsec.c | 4 | ||||
-rw-r--r-- | sbin/isakmpd/message.c | 4 | ||||
-rw-r--r-- | sbin/isakmpd/sa.c | 4 | ||||
-rw-r--r-- | sbin/isakmpd/ui.c | 4 |
5 files changed, 19 insertions, 19 deletions
diff --git a/sbin/isakmpd/ike_quick_mode.c b/sbin/isakmpd/ike_quick_mode.c index 0f66d326eae..0db67a47356 100644 --- a/sbin/isakmpd/ike_quick_mode.c +++ b/sbin/isakmpd/ike_quick_mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ike_quick_mode.c,v 1.107 2011/12/12 07:35:29 yasuoka Exp $ */ +/* $OpenBSD: ike_quick_mode.c,v 1.108 2014/10/09 02:38:56 deraadt Exp $ */ /* $EOM: ike_quick_mode.c,v 1.139 2001/01/26 10:43:17 niklas Exp $ */ /* @@ -438,8 +438,8 @@ initiator_send_HASH_SA_NONCE(struct message *msg) * arbitrary. */ prop_cnt = 2 * prop_cnt + 10; - new_proposal = realloc(proposal, - prop_cnt * sizeof *proposal); + new_proposal = reallocarray(proposal, + prop_cnt, sizeof *proposal); if (!new_proposal) { log_error( "initiator_send_HASH_SA_NONCE: " @@ -450,8 +450,8 @@ initiator_send_HASH_SA_NONCE(struct message *msg) } proposal = new_proposal; - new_transforms_len = realloc(transforms_len, - prop_cnt * sizeof *transforms_len); + new_transforms_len = reallocarray(transforms_len, + prop_cnt, sizeof *transforms_len); if (!new_transforms_len) { log_error( "initiator_send_HASH_SA_NONCE: " @@ -462,8 +462,8 @@ initiator_send_HASH_SA_NONCE(struct message *msg) } transforms_len = new_transforms_len; - new_transform = realloc(transform, - prop_cnt * sizeof *transform); + new_transform = reallocarray(transform, + prop_cnt, sizeof *transform); if (!new_transform) { log_error( "initiator_send_HASH_SA_NONCE: " @@ -474,8 +474,8 @@ initiator_send_HASH_SA_NONCE(struct message *msg) } transform = new_transform; - new_transform_cnt = realloc(transform_cnt, - prop_cnt * sizeof *transform_cnt); + new_transform_cnt = reallocarray(transform_cnt, + prop_cnt, sizeof *transform_cnt); if (!new_transform_cnt) { log_error( "initiator_send_HASH_SA_NONCE: " @@ -486,8 +486,8 @@ initiator_send_HASH_SA_NONCE(struct message *msg) } transform_cnt = new_transform_cnt; - new_transform_len = realloc(transform_len, - prop_cnt * sizeof *transform_len); + new_transform_len = reallocarray(transform_len, + prop_cnt, sizeof *transform_len); if (!new_transform_len) { log_error( "initiator_send_HASH_SA_NONCE: " diff --git a/sbin/isakmpd/ipsec.c b/sbin/isakmpd/ipsec.c index 2853662a1b8..39816f09e03 100644 --- a/sbin/isakmpd/ipsec.c +++ b/sbin/isakmpd/ipsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec.c,v 1.140 2014/01/22 03:09:31 deraadt Exp $ */ +/* $OpenBSD: ipsec.c,v 1.141 2014/10/09 02:38:56 deraadt Exp $ */ /* $EOM: ipsec.c,v 1.143 2000/12/11 23:57:42 niklas Exp $ */ /* @@ -2326,7 +2326,7 @@ ipsec_add_contact(struct message *msg) if (contact_cnt == contact_limit) { cnt = contact_limit ? 2 * contact_limit : 64; - new_contacts = realloc(contacts, cnt * sizeof contacts[0]); + new_contacts = reallocarray(contacts, cnt, sizeof contacts[0]); if (!new_contacts) { log_error("ipsec_add_contact: " "realloc (%p, %lu) failed", contacts, diff --git a/sbin/isakmpd/message.c b/sbin/isakmpd/message.c index e71015d3bd8..c1619142bfa 100644 --- a/sbin/isakmpd/message.c +++ b/sbin/isakmpd/message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: message.c,v 1.126 2007/06/02 01:29:11 pvalchev Exp $ */ +/* $OpenBSD: message.c,v 1.127 2014/10/09 02:38:56 deraadt Exp $ */ /* $EOM: message.c,v 1.156 2000/10/10 12:36:39 provos Exp $ */ /* @@ -1637,7 +1637,7 @@ message_add_payload(struct message *msg, u_int8_t payload, u_int8_t *buf, (unsigned long)sizeof *payload_node); return -1; } - new_iov = (struct iovec *) realloc(msg->iov, (msg->iovlen + 1) * + new_iov = reallocarray(msg->iov, msg->iovlen + 1, sizeof *msg->iov); if (!new_iov) { log_error("message_add_payload: realloc (%p, %lu) failed", diff --git a/sbin/isakmpd/sa.c b/sbin/isakmpd/sa.c index aa3b6b0d8ad..c5533b0bb6a 100644 --- a/sbin/isakmpd/sa.c +++ b/sbin/isakmpd/sa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sa.c,v 1.120 2014/01/23 01:04:28 deraadt Exp $ */ +/* $OpenBSD: sa.c,v 1.121 2014/10/09 02:38:56 deraadt Exp $ */ /* $EOM: sa.c,v 1.112 2000/12/12 00:22:52 niklas Exp $ */ /* @@ -108,7 +108,7 @@ sa_resize(void) int i; struct sa_list *new_tab; - new_tab = realloc(sa_tab, (new_mask + 1) * sizeof(struct sa_list)); + new_tab = reallocarray(sa_tab, new_mask + 1, sizeof(struct sa_list)); if (!new_tab) return; sa_tab = new_tab; diff --git a/sbin/isakmpd/ui.c b/sbin/isakmpd/ui.c index f4cf50b9f15..218783be539 100644 --- a/sbin/isakmpd/ui.c +++ b/sbin/isakmpd/ui.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ui.c,v 1.54 2008/06/10 22:14:02 bluhm Exp $ */ +/* $OpenBSD: ui.c,v 1.55 2014/10/09 02:38:56 deraadt Exp $ */ /* $EOM: ui.c,v 1.43 2000/10/05 09:25:12 niklas Exp $ */ /* @@ -591,7 +591,7 @@ ui_handler(void) } /* If no place left in the buffer reallocate twice as large. */ if (!resid) { - new_buf = realloc(buf, sz * 2); + new_buf = reallocarray(buf, sz, 2); if (!new_buf) { log_print("ui_handler: realloc (%p, %lu) failed", buf, (unsigned long)sz * 2); |