summaryrefslogtreecommitdiff
path: root/sbin/iked
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-12-12 15:52:59 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-12-12 15:52:59 +0000
commitacc5eb369048f72ce5c9753d1847e63fc3deb876 (patch)
tree058beb7399438225de394977580e041f63c3772e /sbin/iked
parent5f2ea907778967125b414979657ebcc7a3f0fc3a (diff)
ibuf_getdata() abuses the rpos from the ibuf. This is no longer allowed
and breaks because ibuf_seek() now uses rpos itself. Now this is just ibuf_get_ibuf() with an extra allocation done. OK tobhe@ tb@
Diffstat (limited to 'sbin/iked')
-rw-r--r--sbin/iked/imsg_util.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sbin/iked/imsg_util.c b/sbin/iked/imsg_util.c
index bf97af6f885..a008872cd38 100644
--- a/sbin/iked/imsg_util.c
+++ b/sbin/iked/imsg_util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imsg_util.c,v 1.21 2023/07/18 15:07:41 claudio Exp $ */
+/* $OpenBSD: imsg_util.c,v 1.22 2023/12/12 15:52:58 claudio Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -80,13 +80,12 @@ ibuf_length(struct ibuf *buf)
struct ibuf *
ibuf_getdata(struct ibuf *buf, size_t len)
{
- void *data;
+ struct ibuf tmp;
- if ((data = ibuf_seek(buf, buf->rpos, len)) == NULL)
+ if (ibuf_get_ibuf(buf, len, &tmp) == -1)
return (NULL);
- buf->rpos += len;
- return (ibuf_new(data, len));
+ return (ibuf_new(ibuf_data(&tmp), ibuf_size(&tmp)));
}
struct ibuf *