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

Adrian Ambrożewicz adrian.ambrozewicz at linux.intel.com
Thu Jan 9 11:32:09 UTC 2020


W dniu 1/8/2020 o 14:19, Eric Blake pisze:
> On 1/7/20 4:13 AM, Adrian Ambrożewicz wrote:
>> 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;
> 
> Why is a cast needed at all?  This is C, an implicit conversion works 
> just as well.
I agree. It was just me being careful with scope of changes :) Should I 
send new patch? And another question - who is the maintainer and how 
should I proceed with patch after acceptance on mailing list?

> 
>>     nbdkit_debug ("content length: %" PRIi64, h->exportsize);
>>
>>     if (strncasecmp (url, "http://", strlen ("http://")) == 0 ||
> 





More information about the Libguestfs mailing list