summaryrefslogtreecommitdiff
path: root/usr.bin/aucat
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-08-14 10:02:11 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-08-14 10:02:11 +0000
commit988c365960679e67f3f59b1e3c8e9403538d8ebe (patch)
tree3feb8f31ee70f5f4a9d79172acba55120ea06f6e /usr.bin/aucat
parent7061d687e5cfe865da42e09d645e3389fb80b225 (diff)
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
Diffstat (limited to 'usr.bin/aucat')
-rw-r--r--usr.bin/aucat/abuf.c4
1 files changed, 3 insertions, 1 deletions
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 <alex@caoua.org>
*
@@ -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;