[Libguestfs] [nbdkit PATCH 4/5] server: Fix backend range check

Eric Blake eblake at redhat.com
Fri Oct 4 02:54:39 UTC 2019


h->exportsize is unsigned, so the assertion as written was a no-op.
It was intended to catch cases where exportsize was left at -1 from
prior to .open (which, until recently, could happen in both the xz and
retry filters).

Fixes: dbdec62725
Signed-off-by: Eric Blake <eblake at redhat.com>
---
 server/backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/backend.c b/server/backend.c
index 5cbbe2c1..f02f4745 100644
--- a/server/backend.c
+++ b/server/backend.c
@@ -229,7 +229,7 @@ backend_valid_range (struct backend *b, struct connection *conn,
 {
   struct b_conn_handle *h = &conn->handles[b->i];

-  assert (h->exportsize >= 0); /* Guaranteed by negotiation phase */
+  assert (h->exportsize <= INT64_MAX); /* Guaranteed by negotiation phase */
   return count > 0 && offset <= h->exportsize &&
     offset + count <= h->exportsize;
 }
-- 
2.21.0




More information about the Libguestfs mailing list