[Libguestfs] [PATCH] Fix lossy conversion of Content-Length

Adrian Ambrożewicz adrian.ambrozewicz at linux.intel.com
Tue Jan 7 10:13:13 UTC 2020


Actual variable holding content length is int64_t, but it was assigned
by explicit cast to size_t. On 32-bit systems it's a lossy conversion,
so it was replaced by casting to int64_t instead.

Signed-off-by: Adrian Ambrożewicz <adrian.ambrozewicz at linux.intel.com>
---
  plugins/curl/curl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c
index 031bd32..fe1330e 100644
--- a/plugins/curl/curl.c
+++ b/plugins/curl/curl.c
@@ -389,7 +389,7 @@ curl_open (int readonly)
      goto err;
    }

-  h->exportsize = (size_t) d;
+  h->exportsize = (int64_t) d;
    nbdkit_debug ("content length: %" PRIi64, h->exportsize);

    if (strncasecmp (url, "http://", strlen ("http://")) == 0 ||
-- 
2.17.1





More information about the Libguestfs mailing list