diff options
author | Cole Robinson <crobinso@redhat.com> | 2010-09-01 13:51:35 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2010-09-10 10:05:43 -0400 |
commit | 18af6f4e64e97095bc95df25fb4a092cbbd6474c (patch) | |
tree | ca26025a441447cff487464f828e52fb40d0fb75 /po/sl.po | |
parent | Fix block statistics with newer versions of Xen (diff) | |
download | libvirt-18af6f4e64e97095bc95df25fb4a092cbbd6474c.tar.gz libvirt-18af6f4e64e97095bc95df25fb4a092cbbd6474c.tar.bz2 libvirt-18af6f4e64e97095bc95df25fb4a092cbbd6474c.zip |
buf: Fix possible infinite loop in EscapeString, VSnprintf
The current code will go into an infinite loop if the printf generated
string is >= 1000, AND exactly 1 character smaller than the amount of free
space in the buffer. When this happens, we are dropped into the loop body,
but nothing will actually change, because count == (buf->size - buf->use - 1),
and virBufferGrow returns unchanged if count < (buf->size - buf->use)
Fix this by removing the '- 1' bit from 'size'. The *nprintf functions handle
the NULL byte for us anyways, so we shouldn't need to manually accommodate
for it.
Here's a bug where we are actually hitting this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=602772
v2: Eric's improvements: while -> if (), remove extra va_list variable,
make sure we report buffer error if snprintf fails
v3: Add tests/virbuftest which reproduces the infinite loop before this
patch, works correctly after
Diffstat (limited to 'po/sl.po')
0 files changed, 0 insertions, 0 deletions