The call to inet_ntop() in repl_ftp_v6_addr() is 1 short to handle
the maximum possible V6 address size for v4 mapping case.

Found by inspection.

Fixes: bd5e81a0e596 ("Userspace Datapath: Add ALG infra and FTP.")
Signed-off-by: Darrell Ball <dlu...@gmail.com>
---

v2: s/IPV6_SCAN_LEN/INET6_ADDRSTRLEN/ in
    char v6_addr_str[IPV6_SCAN_LEN] = {0};
    per review by David Marchand.

 lib/conntrack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 6b66750..0fedddd 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -3159,9 +3159,9 @@ repl_ftp_v6_addr(struct dp_packet *pkt, struct ct_addr 
v6_addr_rep,
         return 0;
     }
 
-    char v6_addr_str[IPV6_SCAN_LEN] = {0};
+    char v6_addr_str[INET6_ADDRSTRLEN] = {0};
     ovs_assert(inet_ntop(AF_INET6, &v6_addr_rep.ipv6_aligned, v6_addr_str,
-                         IPV6_SCAN_LEN - 1));
+                         sizeof v6_addr_str));
     modify_packet(pkt, ftp_data_start + addr_offset_from_ftp_data_start,
                   addr_size, v6_addr_str, strlen(v6_addr_str),
                   orig_used_size);
-- 
1.9.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to