bhyve: Don't stack-allocate huge error buffers

_POSIX2_LINE_MAX is 2048. Allocate the buffers on the heap instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
This commit is contained in:
Peter Krempa 2022-09-20 11:16:27 +02:00
parent 8d76c9390e
commit 194c75f458

View File

@ -380,7 +380,7 @@ virBhyveGetDomainTotalCpuStats(virDomainObj *vm,
{
struct kinfo_proc *kp;
kvm_t *kd;
char errbuf[_POSIX2_LINE_MAX];
g_autofree char *errbuf = g_new0(char, _POSIX2_LINE_MAX);
int nprocs;
int ret = -1;
@ -481,7 +481,7 @@ virBhyveProcessReconnectAll(struct _bhyveConn *driver)
{
kvm_t *kd;
struct bhyveProcessReconnectData data;
char errbuf[_POSIX2_LINE_MAX];
g_autofree char *errbuf = g_new0(char, _POSIX2_LINE_MAX);
if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL) {
virReportError(VIR_ERR_SYSTEM_ERROR,