Am 12.05.2019 20:10, schrieb David Howells:
> walter harms <wha...@bfs.de> wrote:
> 
>>> +   ret = dsize;
>>> +   if (size > 0) {
>>> +           if (dsize > size) {
>>> +                   ret = -ERANGE;
>>> +                   goto error_key;
>>>             }
>>> +           memcpy(buffer, data, dsize);
>>>     }
>>>  
>>
>> i am confused: if size is <= 0 then the error is in dsize ?
> 
> See this bit, before that hunk:
> 
>> +    if (ret < 0)
>> +            goto error_key;
> 
> David
> 

Sorry, you misunderstood me, my fault, i did not see that size is unsigned.
NTL i do not think size=0 is useful.

You get size from outside, and if i follow the flow correct
the first use of it is to check size>0.
perhaps you can check size at start and simply return.
Now if size==0 it will return dsize and give the impression
that buffer is used (it is not).

while you are there:
  flags |= YFS_ACL_WANT_ACL is always flags = YFS_ACL_WANT_ACL;
since flags is 0 at this point.
IMHO that sould be moved to the strcmp() section.

hope that helps,

re,
 wh

Reply via email to