From 147a3fc6f0d87643efe0f3e1e161dc8077ac4f06 Mon Sep 17 00:00:00 2001 From: ratchov Date: Thu, 14 Aug 2008 10:02:10 +0000 Subject: [PATCH] in abuf_rgetblk() the ``start'' pointer may take a value beyond the end of the buffer because periodic boundary conditions of the FIFO are not met ok jakemsr --- usr.bin/aucat/abuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/aucat/abuf.c b/usr.bin/aucat/abuf.c index e6f4803b382..574b80262b2 100644 --- a/usr.bin/aucat/abuf.c +++ b/usr.bin/aucat/abuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: abuf.c,v 1.5 2008/08/14 09:46:36 ratchov Exp $ */ +/* $OpenBSD: abuf.c,v 1.6 2008/08/14 10:02:10 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -97,6 +97,8 @@ abuf_rgetblk(struct abuf *buf, unsigned *rsize, unsigned ofs) start = buf->start + ofs; used = buf->used - ofs; + if (start >= buf->len) + start -= buf->len; count = buf->len - start; if (count > used) count = used; -- 2.20.1