From: claudio Date: Tue, 6 Jun 2023 16:09:35 +0000 (+0000) Subject: Use same pattern to work with offset by using a uint8_t pointer that X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=09afe4dcdfb251d030967731f6b9f9553478691f;p=openbsd Use same pattern to work with offset by using a uint8_t pointer that is loaded with ibuf_data(). This is by no means better but allows to switch ibuf_data() to return void *. OK tb@ --- diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c index a055c2f1be1..cef586817a1 100644 --- a/sbin/iked/ikev2_pld.c +++ b/sbin/iked/ikev2_pld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_pld.c,v 1.128 2023/05/23 13:12:19 claudio Exp $ */ +/* $OpenBSD: ikev2_pld.c,v 1.129 2023/06/06 16:09:35 claudio Exp $ */ /* * Copyright (c) 2019 Tobias Heider @@ -1525,9 +1525,10 @@ ikev2_pld_ts(struct iked *env, struct ikev2_payload *pld, struct sockaddr_in s4; struct sockaddr_in6 s6; uint8_t buf[2][128]; + uint8_t *msgbuf = ibuf_data(msg->msg_data); uint8_t *ptr; - ptr = ibuf_data(msg->msg_data) + offset; + ptr = msgbuf + offset; switch (type) { case IKEV2_TS_IPV4_ADDR_RANGE: @@ -1867,6 +1868,7 @@ ikev2_pld_cp(struct iked *env, struct ikev2_payload *pld, struct iked_addr *addr; struct sockaddr_in *in4; struct sockaddr_in6 *in6; + uint8_t *msgbuf = ibuf_data(msg->msg_data); uint8_t *ptr; size_t len; uint8_t buf[128]; @@ -1875,7 +1877,7 @@ ikev2_pld_cp(struct iked *env, struct ikev2_payload *pld, if (ikev2_validate_cp(msg, offset, left, &cp)) return (-1); - ptr = ibuf_data(msg->msg_data) + offset + sizeof(cp); + ptr = msgbuf + offset + sizeof(cp); len = left - sizeof(cp); log_debug("%s: type %s length %zu",