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

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



* 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


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