[PATCH 3/6] virNetDevIPCheckIPv6Forwarding: Don't NUL terminate buffer from virFileReadAll

Peter Krempa via Devel posted 6 patches 6 days, 7 hours ago
[PATCH 3/6] virNetDevIPCheckIPv6Forwarding: Don't NUL terminate buffer from virFileReadAll
Posted by Peter Krempa via Devel 6 days, 7 hours ago
From: Peter Krempa <pkrempa@redhat.com>

The buffer is already terminated. Luckily the last character in the
buffer was a newline so no information was mangled.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/util/virnetdevip.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
index 8786bb236e..c82125b706 100644
--- a/src/util/virnetdevip.c
+++ b/src/util/virnetdevip.c
@@ -547,10 +547,6 @@ virNetDevIPCheckIPv6Forwarding(void)
         return false;
     }

-    /* Dropping the last character to stop the loop */
-    if (len > 0)
-        buf[len-1] = '\0';
-
     cur = buf;
     while (cur) {
         char route[33], flags[9], iface[9];
-- 
2.53.0