[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Bug in largepost.c example
From: |
Martin Bonner |
Subject: |
Re: [libmicrohttpd] Bug in largepost.c example |
Date: |
Fri, 11 Dec 2015 14:09:17 +0000 |
Andreas Wehrmann wrote:
>>On 12/11/2015 08:51 AM, Anton Botvalde wrote:
>> Hello,
>>
>> In the largepost.c example the iterate_post callback has a bug in fwrite >-
>> if (size > 0)
>> {
>> if (!fwrite (data, size, sizeof (char), con_info->fp))
>> return MHD_NO;
>> }
>>
>> should be
>>
>> if (size > 0)
>> {
>> if (!fwrite (data, sizeof (char), size , con_info->fp))
>> return MHD_NO;
>> }
>If I'm not mistaken if shouldn't matter at all because sizeof(char) is 1
>by definition.
It never matters whether sizeof(char) is 1 or not (it is), because in
practise the two are just multiplied together and the total written out.
In principle it is wrong though. You are writing out size chars,
not 1 object that is size bytes long.