Fix socks_proxy_port pointing to invalid data
PATCH 1/1 Fix socks_proxy_port pointing to invalid data
When setting the SOCKS proxy through the management interface, the socks_proxy_port pointer would be set to a value that's no longer valid by the time it's used by do_preresolve_host.
--- src/openvpn/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/init.c +1 -1
@@ -150,7 +150,7 @@ management_callback_proxy_cmd(void *arg, const char **p)else if (streq (p[1 ],"SOCKS" )) { ce->socks_proxy_server =string_alloc (p[2 ], gc); - ce->socks_proxy_port = p[3 ]; + ce->socks_proxy_port =string_alloc (p[3 ], gc); ret = true; } }
Signature · 1 line
2.11.0 (Apple Git-81)
Am 07.07.17 um 21:59 schrieb Thomas Veerman via Openvpn-devel:
Quoted 15 lines
When setting the SOCKS proxy through the management interface, the
socks_proxy_portpointer would be set to a value that's no longer valid by the time it's used bydo_preresolve_host.Signed-off-by Thomas Veerman <[email protected]...>--- src/openvpn/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)src/openvpn/init.c +0
-0
src/openvpn/init.c management_callback_proxy_cmd(void *arg, const char **p) · line 156
Quoted 8 lines
src/openvpn/init.c +1
-1@@ -150,7 +150,7 @@ management_callback_proxy_cmd(void *arg, const char **p)else if (streq (p[1 ],"SOCKS" )) { ce->socks_proxy_server =string_alloc (p[2 ], gc); - ce->socks_proxy_port = p[3 ]; + ce->socks_proxy_port =string_alloc (p[3 ], gc); ret = true; } }
ACK. Probably my fault, when I changed that from int to string.
Arne
Thomas Veerman via Openvpn-devel <[email protected]> on Fri, 2017/07/07 21:59:
src/openvpn/init.c management_callback_proxy_cmd(void *arg, const char **p) · line 156
Quoted 8 lines
else if (streq(p[1], "SOCKS")) { ce->socks_proxy_server = string_alloc(p[2], gc);src/openvpn/init.c +1
-1- ce->socks_proxy_port = p[3 ]; + ce->socks_proxy_port =string_alloc (p[3 ], gc); ret = true; } }
If we allocate memory here, is it freed later?
A quick look at options.h shows this is (const char *).
Signature · 3 lines
main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];)
putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}Quoted 11 lines · Christian Hesse
Thomas Veerman via Openvpn-devel <[email protected]> on Fri, 2017/07/07 21:59:
src/openvpn/init.c management_callback_proxy_cmd(void *arg, const char **p) · line 156
Quoted 8 lines
else if (streq(p[1], "SOCKS")) { ce->socks_proxy_server = string_alloc(p[2], gc);src/openvpn/init.c +1
-1- ce->socks_proxy_port = p[3 ]; + ce->socks_proxy_port =string_alloc (p[3 ], gc); ret = true; } }
Quoted 3 lines
If we allocate memory here, is it freed later?
A quick look at
options.hshows this is (const char *).
It is allocated with a gc (garbage collector), so when there is is a gc_free() on the gc, all allocations connected to that gc gets freed all at once.
Signature · 4 lines
kind regards, David Sommerseth OpenVPN Technologies, Inc