>>
>> +    buf[len] = '\0';
>> +
> 
> I think it would be more appropriate here to check if buf[len] == '\0' and 
> return an error otherwise.

Nevermind, I just had a closer look and I actually think your approach
is fine. I hadn't considered the possibility of someone deliberately
passing a non-null-terminated string with a specific length.

>> Signed-off-by: Miaoqing Pan <[email protected]>

Reviewed-by: Christoph Böhmwalder <[email protected]>

-- 
Regards,
Christoph

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to