[libvirt] [PATCH libvirt-snmp 1/3] allocate enough space for trailing NULL in string

Laine Stump laine at laine.org
Tue Oct 18 17:13:13 UTC 2011


This bug was found by coverity. See:

  https://bugzilla.redhat.com/show_bug.cgi?id=732015
---
 src/libvirtGuestTable_data_get.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/libvirtGuestTable_data_get.c b/src/libvirtGuestTable_data_get.c
index 2430f9c..cc31e9e 100644
--- a/src/libvirtGuestTable_data_get.c
+++ b/src/libvirtGuestTable_data_get.c
@@ -201,7 +201,7 @@ libvirtGuestName_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, char **libvirtGu
     if (!rowreq_ctx->data.libvirtGuestName)
     	return MFD_SKIP;
 
-    len = strlen(rowreq_ctx->data.libvirtGuestName);
+    len = strlen(rowreq_ctx->data.libvirtGuestName) + 1;
     if ((NULL == (* libvirtGuestName_val_ptr_ptr )) ||
         ((* libvirtGuestName_val_ptr_len_ptr ) < len)) {
         /*
-- 
1.7.6.4




More information about the libvir-list mailing list