From edece116e2e269fd895cf69b287f3f474dd4c49f Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 12 Dec 2023 15:54:18 +0000 Subject: [PATCH] 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@ --- usr.sbin/rpki-client/io.c | 11 +++-------- 1 file 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 * Copyright (c) 2019 Kristaps Dzonsons @@ -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"); } /* -- 2.20.1