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

Adrian Ambrożewicz adrian.ambrozewicz at linux.intel.com
Fri Jan 10 09:34:07 UTC 2020


 From a120342e0d3d20962396e6bf5bd5ac30c66b5983 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrian=20Ambro=C5=BCewicz?=
  <adrian.ambrozewicz at linux.intel.com>
Date: Tue, 7 Jan 2020 11:07:08 +0100
Subject: [PATCH 1/1] Fix lossy conversion of Content-Length
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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 removed altogether.

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..633840a 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 = 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