commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-340-g9bbef


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-340-g9bbef0c
Date: Mon, 09 Sep 2013 20:37:11 +0000

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  9bbef0cb92f92b12586d0368ff05b15f73ba74c9 (commit)
      from  5b5ba41fae8baa3cae3d20bab6b8ef8e79f10aaa (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=9bbef0cb92f92b12586d0368ff05b15f73ba74c9


commit 9bbef0cb92f92b12586d0368ff05b15f73ba74c9
Author: Mats Erik Andersson <address@hidden>
Date:   Mon Sep 9 15:20:10 2013 +0200

    ftp: Guard buffer size.

diff --git a/ChangeLog b/ChangeLog
index 32217f3..3cf43a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
 2013-09-08  Mats Erik Andersson  <address@hidden>
 
+       ftp: Guard buffer size.
+       An evil SHELL in environment would overflow a buffer.
+
+       * ftp/cmds.c (shell): Step over a slash in NAMEP
+       only if one was found.  Use strncat() with correct
+       length parameter, instead of strcat().
+
+
+       Minor coding issues.
+
+       * ftp/ftp.c (pswitch) <struct comvars>: Declare array
+       sizes for `nti[]' and `nto[]' to be identical to those
+       of `ntin[]' and `ntout[]'.
+
+       * ftp/ftp_var.h (stringbase, argbuf, argbase):
+       Remove declarations.
+       * ftp/main.c (argbase, argbuf, atringbase):
+       New static string variables.
+
+       * telnet/Makefile.am: Add @address@hidden
+       (AM_CPPFLAGS): Add $(PATHDEF_BSHELL).
+       * telnet/commands.c (shell): Use PATH_BSHELL as default
+       shell.  Put assignment before if-clause.
+
+2013-09-08  Mats Erik Andersson  <address@hidden>
+
        ifconfig: Legacy use with GNU/kFreeBSD.
 
        * configure.ac: Check for header <netinet/ether.h>.
diff --git a/NEWS b/NEWS
index c1f4992..6a50f88 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@ Called as `pftp', passive mode is preset.  New switch 
`-e/--no-edit'
 for compatibility with other implementations.  Can now be built
 without readline ability: configure using `--disable-readline'.
 New command `lpwd' avoids a shell call for a common task.
+The legacy limit for lengths of input lines (previously 200)
+has been removed.  Now it is system dependent and is in common
+with most other tools.
 
 * ifconfig
 
diff --git a/ftp/cmds.c b/ftp/cmds.c
index a89ecbe..15ecefc 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -1623,9 +1623,11 @@ shell (int argc, char **argv _GL_UNUSED_PARAMETER)
        shell = PATH_BSHELL;
       namep = strrchr (shell, '/');
       if (namep == NULL)
-       namep = shell;
+       namep = shell;          /* No slash in this name.  */
+      else
+       namep++;                /* Skip the slash character.  */
       strcpy (shellnam, "-");
-      strcat (shellnam, ++namep);
+      strncat (shellnam, namep, sizeof (shellnam) - 2);
       if (strcmp (namep, "sh") != 0)
        shellnam[0] = '+';
       if (debug)
diff --git a/ftp/ftp.c b/ftp/ftp.c
index 318a2f6..6fd0e19 100644
--- a/ftp/ftp.c
+++ b/ftp/ftp.c
@@ -314,11 +314,14 @@ login (char *host)
        printf ("Name (%s): ", host);
       if (fgets (tmp, sizeof (tmp) - 1, stdin))
        {
-         /* If they press Ctrl-d immediately, it's empty.  */
+         /* If the user presses return immediately, we get "\n".
+          * In all other cases, the assignment is a no-op,
+          * and is always well defined thanks to fgets().
+          */
          tmp[strlen (tmp) - 1] = '\0';
        }
       else
-       *tmp = '\0';
+       *tmp = '\0';            /* Ctrl-D received.  */
       if (*tmp == '\0')
        user = myname;
       else
@@ -1614,8 +1617,8 @@ pswitch (int flag)
     int runqe;
     int mcse;
     int ntflg;
-    char nti[17];
-    char nto[17];
+    char nti[sizeof (ntin)];
+    char nto[sizeof (ntout)];
     int mapflg;
     char *mi;
     char *mo;
diff --git a/ftp/ftp_var.h b/ftp/ftp_var.h
index dedb357..0b25f5a 100644
--- a/ftp/ftp_var.h
+++ b/ftp/ftp_var.h
@@ -116,10 +116,6 @@ FTP_EXTERN jmp_buf toplevel;       /* non-local goto stuff 
for cmd scanner */
 FTP_EXTERN char *line;         /* input produced by readline or getline */
 FTP_EXTERN size_t linelen;     /* allocated length of the same, if known */
 
-FTP_EXTERN char *stringbase;   /* current scan point in line buffer */
-FTP_EXTERN char *argbuf;       /* allocated argument storage buffer */
-FTP_EXTERN char *argbase;      /* current storage point in arg buffer */
-
 #ifndef MAXMARGV
 # define MAXMARGV 20
 #endif
diff --git a/ftp/main.c b/ftp/main.c
index 630cfe5..b640d3c 100644
--- a/ftp/main.c
+++ b/ftp/main.c
@@ -96,6 +96,10 @@
 
 static char *slurpstring (void);
 
+static char *argbase;          /* current pointer into arg buffer */
+static char *argbuf;           /* allocated argument storage buffer */
+static char *stringbase;       /* current scan point in line buffer */
+
 #define DEFAULT_PROMPT "ftp> "
 static char *prompt = NULL;
 
diff --git a/telnet/Makefile.am b/telnet/Makefile.am
index 02e6ae9..8ebd02b 100644
--- a/telnet/Makefile.am
+++ b/telnet/Makefile.am
@@ -18,8 +18,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see `http://www.gnu.org/licenses/'.
 
address@hidden@
+
 AM_CPPFLAGS = \
        -DTERMCAP -DLINEMODE -DKLUDGELINEMODE -DENV_HACK \
+       $(PATHDEF_BSHELL) \
        $(iu_INCLUDES) \
        -I$(top_srcdir) \
        $(NCURSES_INCLUDE) $(INCIDN)
diff --git a/telnet/commands.c b/telnet/commands.c
index a9ed244..f0307f7 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -1585,8 +1585,9 @@ shell (int argc, char *argv[] _GL_UNUSED_PARAMETER)
 
        shellp = getenv ("SHELL");
        if (shellp == NULL)
-         shellp = "/bin/sh";
-       if ((shellname = strrchr (shellp, '/')) == 0)
+         shellp = PATH_BSHELL;
+       shellname = strrchr (shellp, '/');
+       if (shellname == NULL)
          shellname = shellp;
        else
          shellname++;

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

Summary of changes:
 ChangeLog          |   26 ++++++++++++++++++++++++++
 NEWS               |    3 +++
 ftp/cmds.c         |    6 ++++--
 ftp/ftp.c          |   11 +++++++----
 ftp/ftp_var.h      |    4 ----
 ftp/main.c         |    4 ++++
 telnet/Makefile.am |    3 +++
 telnet/commands.c  |    5 +++--
 8 files changed, 50 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]