[libvirt] [PATCH] network utilities: Allocate space for terminating NUL in virSocketFormatAddr

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

 



* src/util/network.c: Allocate an additional byte for virSocketFormatAddr's
  return buffer
---
 src/util/network.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/network.c b/src/util/network.c
index 56426e7..f6588c7 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -135,12 +135,12 @@ virSocketFormatAddr(virSocketAddrPtr addr) {
         return NULL;
 
     if (addr->stor.ss_family == AF_INET) {
-        outlen = INET_ADDRSTRLEN;
+        outlen = INET_ADDRSTRLEN + 1;
         inaddr = &addr->inet4.sin_addr;
     }
 
     else if (addr->stor.ss_family == AF_INET6) {
-        outlen = INET6_ADDRSTRLEN;
+        outlen = INET6_ADDRSTRLEN + 1;
         inaddr = &addr->inet6.sin6_addr;
     }
 
-- 
1.6.2.5

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]