qemu: avoid denial of service reading from QEMU guest agent (CVE-2018-1064)
qemu: avoid denial of service reading from QEMU guest agent (CVE-2018-1064)

We read from the agent until seeing a \r\n pair to indicate a completed
reply or event. To avoid memory denial-of-service though, we must have a
size limit on amount of data we buffer. 10 MB is large enough that it
ought to cope with normal agent replies, and small enough that we're not
consuming unreasonable mem.

This is identical to the flaw we had reading from the QEMU monitor
as CVE-2018-5748, so rather embarrassing that we forgot to fix
the agent code at the same time.

Signed-off-by: Daniel P. Berrangé <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

fabianfreyer/libvirt,olafhering/libvirt,jardasgit/libvirt,andreabolognani/libvirt,jardasgit/libvirt,zippy2/libvirt,olafhering/libvirt,nertpinx/libvirt,andreabolognani/libvirt,olafhering/libvirt,eskultety/libvirt,zippy2/libvirt,jfehlig/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,zippy2/libvirt,eskultety/libvirt,libvirt/libvirt,nertpinx/libvirt,crobinso/libvirt,nertpinx/libvirt,jfehlig/libvirt,andreabolognani/libvirt,jardasgit/libvirt,crobinso/libvirt,crobinso/libvirt,crobinso/libvirt,fabianfreyer/libvirt,eskultety/libvirt,andreabolognani/libvirt,jfehlig/libvirt,andreabolognani/libvirt,zippy2/libvirt,olafhering/libvirt,jardasgit/libvirt,libvirt/libvirt,eskultety/libvirt,libvirt/libvirt,libvirt/libvirt,jardasgit/libvirt,eskultety/libvirt,jfehlig/libvirt,fabianfreyer/libvirt