mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
* src/buf.c: applied patch from Masayuki Sunou fixing a loop
due to an error in growing buffers. Daniel
This commit is contained in:
parent
b001650c7d
commit
3c999f7ff4
@ -1,3 +1,8 @@
|
||||
Thu Aug 30 15:11:44 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/buf.c: applied patch from Masayuki Sunou fixing a loop
|
||||
due to an error in growing buffers.
|
||||
|
||||
Wed Aug 29 14:43:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
|
||||
|
||||
* src/xen_internal.c (xenHypervisorDomainInterfaceStats): Swap
|
||||
|
10
src/buf.c
10
src/buf.c
@ -159,7 +159,7 @@ virBufferContentAndFree (virBufferPtr buf)
|
||||
int
|
||||
virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
||||
{
|
||||
int size, count;
|
||||
int size, count, grow_size;
|
||||
va_list locarg, argptr;
|
||||
|
||||
if ((format == NULL) || (buf == NULL)) {
|
||||
@ -172,7 +172,8 @@ virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
||||
locarg)) < 0) || (count >= size - 1)) {
|
||||
buf->content[buf->use] = 0;
|
||||
va_end(locarg);
|
||||
if (virBufferGrow(buf, 1000) < 0) {
|
||||
grow_size = (count > 1000) ? count : 1000;
|
||||
if (virBufferGrow(buf, grow_size) < 0) {
|
||||
return (-1);
|
||||
}
|
||||
size = buf->size - buf->use - 1;
|
||||
@ -198,7 +199,7 @@ virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
||||
int
|
||||
virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
|
||||
{
|
||||
int size, count, len;
|
||||
int size, count, len, grow_size;
|
||||
char *escaped, *out;
|
||||
const char *cur;
|
||||
|
||||
@ -248,7 +249,8 @@ virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
|
||||
while (((count = snprintf(&buf->content[buf->use], size, format,
|
||||
(char *)escaped)) < 0) || (count >= size - 1)) {
|
||||
buf->content[buf->use] = 0;
|
||||
if (virBufferGrow(buf, 1000) < 0) {
|
||||
grow_size = (count > 1000) ? count : 1000;
|
||||
if (virBufferGrow(buf, grow_size) < 0) {
|
||||
free(escaped);
|
||||
return (-1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user