From: Willy Tarreau Date: Tue, 15 Sep 2020 09:25:54 +0000 (+0200) Subject: BUG/MINOR: server: report correct error message for invalid port on "socks4" X-Git-Tag: v2.1.9~16 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=f75b42ae39b57c5ecdab5f4969241ab882aab88e;p=haproxy-2.1.git BUG/MINOR: server: report correct error message for invalid port on "socks4" The socks4 keyword parser was a bit too much copy-pasted, it only checks for a null port and reports "invalid range". Let's properly check for the 1-65535 range and report the correct error. It may be backported everywhere "socks4" is present (2.0). (cherry picked from commit 9743f709d03c036b7a6da2fb260d0e77f9e04a3d) Signed-off-by: Willy Tarreau (cherry picked from commit e96489ea5e0408d852fc1dd4318926923916c230) Signed-off-by: Willy Tarreau --- diff --git a/src/server.c b/src/server.c index 1f48d66..1233c67 100644 --- a/src/server.c +++ b/src/server.c @@ -970,8 +970,8 @@ static int srv_parse_socks4(char **args, int *cur_arg, goto err; } - if (!port_low) { - ha_alert("'%s': invalid port range %d-%d.\n", args[*cur_arg], port_low, port_high); + if (port_low <= 0 || port_low > 65535) { + ha_alert("'%s': invalid port %d.\n", args[*cur_arg], port_low); goto err; }