[Openvpn-devel] socks: use the right function when printing struct openvpn_sockaddr

Message ID 20191109163714.25506-1-a@unstable.cc
State Accepted
Headers show
Series
  • [Openvpn-devel] socks: use the right function when printing struct openvpn_sockaddr
Related show

Commit Message

Antonio Quartulli Nov. 9, 2019, 4:37 p.m.
57623b4e introduced a print_sockaddr() call in socks.c to print an
openvpn_sockaddr object.

However, this is not correct because print_sockaddr() expects a sockaddr
object as argument instead of openvpn_sockaddr.

This error did not lead to any issue because the two objects are very
similar in regards to the data accessed by print_sockaddr().

Fix this by replacing print_sockaddr() with print_openvpn_sockaddr().

Signed-off-by: Antonio Quartulli <a@unstable.cc>
---
 src/openvpn/socks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arne Schwabe Nov. 9, 2019, 5:02 p.m. | #1
Am 09.11.19 um 17:37 schrieb Antonio Quartulli:
> 57623b4e introduced a print_sockaddr() call in socks.c to print an
> openvpn_sockaddr object.
> 
> However, this is not correct because print_sockaddr() expects a sockaddr
> object as argument instead of openvpn_sockaddr.
> 
> This error did not lead to any issue because the two objects are very
> similar in regards to the data accessed by print_sockaddr().
> 
> Fix this by replacing print_sockaddr() with print_openvpn_sockaddr().
> 

Not compile tested but looks like the right fix to me.

Acked-By: Arne Schwabe <arne@rfc2549.org>

Arne
Gert Doering Nov. 9, 2019, 5:32 p.m. | #2
Acked-by: Gert Doering <gert@greenie.muc.de>

Thanks for fixing my oversight (amazing we both did not see the
warning in the first patch...).   socks.c compiles without warning
now, and still prints the right address.

Your patch has been applied to the master and release/2.4 branch (bugfix).

commit 6c39b4dc4766594c6517043af59aeea53ea009d0 (master)
commit 0ba4f91667b8931684e704d1836d71c893e3b9f6 (resolve/2.4)
Author: Antonio Quartulli
Date:   Sat Nov 9 17:37:14 2019 +0100

     socks: use the right function when printing struct openvpn_sockaddr

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20191109163714.25506-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19073.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c
index ad3a70b2..57f0cee2 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/socks.c
@@ -416,7 +416,7 @@  recv_socks_reply(socket_descriptor_t sd,
         memcpy(&addr->addr.in4.sin_port, buf + 8, sizeof(addr->addr.in4.sin_port));
         struct gc_arena gc = gc_new();
         msg(M_INFO, "SOCKS proxy wants us to send UDP to %s",
-            print_sockaddr(addr, &gc));
+            print_openvpn_sockaddr(addr, &gc));
         gc_free(&gc);
     }