[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-198-g73d53fe

Mats Erik Andersson <[email protected]> Fri, 02 Nov 2012 10:05:03 +0000
Newsgroups gmane.comp.gnu.inetutils.cvs
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  73d53fe325d456898f1df0c22e79f0e6a9d797e2 (commit)
      from  d94aaf66915ccc93e913368bc7382c6fda6630bd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=73d53fe325d456898f1df0c22e79f0e6a9d797e2


commit 73d53fe325d456898f1df0c22e79f0e6a9d797e2
Author: Mats Erik Andersson <[email protected]>
Date:   Fri Nov 2 10:49:52 2012 +0100

    telnet: Port sanity check.

diff --git a/ChangeLog b/ChangeLog
index ffc7b76..d54da07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-10-02  Mats Erik Andersson  <[email protected]>
+
+	* telnet/commands.c (tn): New block with sanity check of
+	numerical port, being out of range, or mixed with letters.
+
 2012-10-01  Mats Erik Andersson  <[email protected]>
 
 	ftp: Build without readline support.
diff --git a/telnet/commands.c b/telnet/commands.c
index 0375e72..e49aace 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -2544,6 +2544,25 @@ tn (int argc, char *argv[])
 	}
       else
 	telnetport = 0;
+      if (*portp >= '0' && *portp <= '9')
+	{
+	  long long int val;
+	  char *endp;
+
+	  val = strtoll (portp, &endp, 10);
+
+	  if ((errno == ERANGE && (val == LLONG_MAX || val == LLONG_MIN))
+	      || (*endp == '\0' && (val < 1 || val > 65535)))
+	    {
+	      printf ("Port number %s is out of range.\n", portp);
+	      return 0;
+	    }
+	  else if (*endp)
+	    {
+	      printf ("Invalid port name '%s'.\n", portp);
+	      return 0;
+	    }
+	}
     }
 
   free (hostname);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    5 +++++
 telnet/commands.c |   19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU Inetutils