qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V2 2/6] libqblock type and structure defines


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH V2 2/6] libqblock type and structure defines
Date: Mon, 10 Sep 2012 22:12:47 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/10/2012 09:26 PM, Wenchao Xia wrote:

>>> +#define QB_ERR_STRING_SIZE (1024)
>>> +struct QBroker {
>>> +    /* last error */
>>> +    char err_msg[QB_ERR_STRING_SIZE];
>>
>> Is this fixed-width struct going to bite us in the future?  Suppose I
>> pass in a file name that is already 1000 bytes long; it seems like I
>> might be able to get you to overflow this buffer if your error message
>> includes the name of my offending file.
>>
>   Yes it will, thanks for mention me. The resource will always have a
> limit, I guess I can just increase the size to 4k to solve the issue.

A 4k limit is still an easily reachable limit.  PATH_MAX is typically
4k, and it is quite possible to create and access files in a hierarchy
so deep that they are longer than PATH_MAX.  I still think you are
better off malloc'ing a pointer than trying to claim a fixed width field
solves all possible messages.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]