Re: [libvirt] [PATCH] Avoid crash in virBufferEscapeString

2009-10-15 Thread Laine Stump
On 10/15/2009 06:03 AM, Chris Lalancette wrote: Good catch. The hardcode of 100 threw me at first, but I see that we appropriately grow the buffer as needed in the loop below, so I think this works. I thought of trying to make a better guess, but when I saw that virBufferVSprintf just use

Re: [libvirt] [PATCH] Avoid crash in virBufferEscapeString

2009-10-15 Thread Daniel Veillard
On Wed, Oct 14, 2009 at 11:55:19PM -0400, Laine Stump wrote: > If virBufferEscapeString is called on a buffer that has 0 bytes of > space, a size of -1 will be passed to snprintf, resulting in a > segmentation fault. This patch checks for 0 space, and grows the > buffer if needed prior to determini

Re: [libvirt] [PATCH] Avoid crash in virBufferEscapeString

2009-10-15 Thread Chris Lalancette
Laine Stump wrote: > If virBufferEscapeString is called on a buffer that has 0 bytes of > space, a size of -1 will be passed to snprintf, resulting in a > segmentation fault. This patch checks for 0 space, and grows the > buffer if needed prior to determining size. > > I discovered this when I acc

[libvirt] [PATCH] Avoid crash in virBufferEscapeString

2009-10-14 Thread Laine Stump
If virBufferEscapeString is called on a buffer that has 0 bytes of space, a size of -1 will be passed to snprintf, resulting in a segmentation fault. This patch checks for 0 space, and grows the buffer if needed prior to determining size. I discovered this when I accidentally made virBufferEscapeS