summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2023-12-12 15:54:19 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2023-12-12 15:54:19 +0000
commit0f0f42d4a549ee911b8f96f3c5df89de85916a1c (patch)
tree2405adbe3346c702408421cf155fefb10d519f7b
parentacc5eb369048f72ce5c9753d1847e63fc3deb876 (diff)
io_read_buf() abused the ibuf internal rpos which is no longer allowed.
This is now just a simple wrapper around ibuf_get(). OK tb@
-rw-r--r--usr.sbin/rpki-client/io.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.sbin/rpki-client/io.c b/usr.sbin/rpki-client/io.c
index a3b988ef0b1..3d8b79deb43 100644
--- a/usr.sbin/rpki-client/io.c
+++ b/usr.sbin/rpki-client/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.23 2023/06/20 15:15:14 claudio Exp $ */
+/* $OpenBSD: io.c,v 1.24 2023/12/12 15:54:18 claudio Exp $ */
/*
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -100,15 +100,10 @@ io_close_buffer(struct msgbuf *msgbuf, struct ibuf *b)
void
io_read_buf(struct ibuf *b, void *res, size_t sz)
{
- char *tmp;
-
if (sz == 0)
return;
- tmp = ibuf_seek(b, b->rpos, sz);
- if (tmp == NULL)
- errx(1, "bad internal framing, buffer too short");
- b->rpos += sz;
- memcpy(res, tmp, sz);
+ if (ibuf_get(b, res, sz) == -1)
+ err(1, "bad internal framing");
}
/*