[PATCH 1/8] bhyve: Don't stack-allocate huge error buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/bhyve/bhyve_process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 80d5a8804f..c8e1a10afe 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -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,
-- 
2.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux