From 45f7a362e0fa7afc6ef417c023a50faad23a429e Mon Sep 17 00:00:00 2001 From: leitner Date: Tue, 10 Nov 2020 21:23:45 +0000 Subject: [PATCH] abort loop if EOF --- buffer/buffer_seek.c | 1 + 1 file changed, 1 insertion(+) diff --git a/buffer/buffer_seek.c b/buffer/buffer_seek.c index 2876ea7..ed3656d 100644 --- a/buffer/buffer_seek.c +++ b/buffer/buffer_seek.c @@ -25,6 +25,7 @@ ssize_t buffer_seek(buffer* b,size_t len) { while (len > 0) { ssize_t r = buffer_feed(b); if (r < 0) return -1; + if (r == 0) break; if ((size_t)r > len) r = len; // can't happen len -= r; b->p = b->n = 0;