aboutsummaryrefslogtreecommitdiffstats
path: root/src/vty/telnet_interface.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2022-12-03 17:10:42 +0300
committermsuraev <msuraev@sysmocom.de>2022-12-04 11:44:54 +0000
commitaf35eb203c1f75b54770b7977cf71992ea29f690 (patch)
tree0263d2915f9aec8d86685cdee66ef3244c7cbd6f /src/vty/telnet_interface.c
parent6d261343fad0fe3b8af57586b7fd9b0b82a10bcd (diff)
telnet_init_dynif: don't allow negative port
Binding to a negative port should not be allowed. Using signed value for unsigned parameter is a mistake to begin with. Change-Id: I24f957641f2d8e230ccceb331a719496df0fdb1f
Diffstat (limited to 'src/vty/telnet_interface.c')
-rw-r--r--src/vty/telnet_interface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vty/telnet_interface.c b/src/vty/telnet_interface.c
index 17588601..3fcae6ef 100644
--- a/src/vty/telnet_interface.c
+++ b/src/vty/telnet_interface.c
@@ -80,6 +80,9 @@ int telnet_init_dynif(void *tall_ctx, void *priv, const char *ip, int port)
{
int rc;
+ if (port < 0)
+ return -EINVAL;
+
tall_telnet_ctx = talloc_named_const(tall_ctx, 1,
"telnet_connection");