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-334-ge9137


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-334-ge913773
Date: Mon, 09 Sep 2013 20:29:07 +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  e91377394b0431b98f7125f015e0d1c78823589c (commit)
      from  6a47f400cae44ba53f5a4cbcfa43ea95b2e3cadc (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=e91377394b0431b98f7125f015e0d1c78823589c


commit e91377394b0431b98f7125f015e0d1c78823589c
Author: Mats Erik Andersson <address@hidden>
Date:   Tue Sep 3 23:59:10 2013 +0200

    ftp: Avoid numeric size coding.

diff --git a/ChangeLog b/ChangeLog
index 9bda5cb..2bad14a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2013-09-03  Mats Erik Andersson  <address@hidden>
+
+       ftp: Avoid numeric size of char array.
+
+       * ftp/cmds.c (macdef): Use sizeof() to avoid size
+       knowledge about arrays `struct macel.mac_name'
+       or `macbuf'.
+       * ftp/domacro.c (domacro): Likewise.
+       * ftp/ruserpass.c (remote_userpass): Likewise.
+       Change type of I to size_t.
+
+       * doc/inetutils.texi <ftp invocation>: Mention
+       restriction on macro naming.
+
 2013-08-31  Mats Erik Andersson  <address@hidden>
 
        * tests/syslogd.sh: Lengthen sleeping periods.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 1f20163..80c6cda 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -1617,23 +1617,27 @@ address@hidden@samp{-}, then output is sent to the 
terminal.
 @item macdef @var{macro-name}
 Define a macro called @var{macro-name}, with subsequent lines as the
 macro definition. A null line (consecutive newline characters in a
-file, or carriage returns from the terminal) terminates macro input
+file, or carriage returns at a terminal) terminates macro input
 mode.  There is a limit of 16 macros and a total of 4096 characters
-in all defined macros.
+shared by all defined macros.  Only the first eight characters in
address@hidden are significant when determining which
+macro to execute.
 Macros remain defined until a close command is executed.
 
 The macro processor interprets @samp{$} and @samp{\} as
-special characters.  A @samp{$} followed by a number (or numbers) is
-replaced by the corresponding argument on the macro invocation command
-line.
+special characters.  A @samp{$} followed by a number (one or more
+digits) is replaced by the corresponding argument on the macro's
+invocation command line.
 A @samp{$} followed by the letter @samp{i} tells the macro processor
 that the macro is to perform a loop.
-On the first pass @samp{$i}
-is replaced by the first argument on the macro invocation command
-line, on the second pass it is replaced by the second argument, and so
-on.  A @samp{\} followed by any character is replaced by that
-character.  Use the @samp{\} to prevent special treatment of the
address@hidden
+On the first pass, @samp{$i} is replaced by the first argument on
+the macro's invocation command line, while on the second pass it is
+replaced by the second argument, and so forth.
+Iteration proceeds until all arguments have been consumed.
+
+A backslash @samp{\} followed by any character is replaced by that
+character.  Use the backslash @samp{\} to prevent special treatment
+of the dollar sign @samp{$}, as was just explained.
 
 @item mdelete address@hidden
 Delete all @var{remote-files} on the remote machine.
diff --git a/ftp/cmds.c b/ftp/cmds.c
index cf09a9d..10b8d60 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -2519,7 +2519,8 @@ macdef (int argc, char **argv)
     {
       printf ("Enter macro line by line, terminating it with a null line\n");
     }
-  strncpy (macros[macnum].mac_name, argv[1], 8);
+  strncpy (macros[macnum].mac_name, argv[1],
+          sizeof (macros[macnum].mac_name) - 1);
   if (macnum == 0)
     {
       macros[macnum].mac_start = macbuf;
@@ -2529,7 +2530,7 @@ macdef (int argc, char **argv)
       macros[macnum].mac_start = macros[macnum - 1].mac_end + 1;
     }
   tmp = macros[macnum].mac_start;
-  while (tmp != macbuf + 4096)
+  while (tmp < macbuf + sizeof (macbuf))
     {
       if ((c = getchar ()) == EOF)
        {
diff --git a/ftp/domacro.c b/ftp/domacro.c
index 9cad900..1d2cc94 100644
--- a/ftp/domacro.c
+++ b/ftp/domacro.c
@@ -70,7 +70,8 @@ domacro (int argc, char *argv[])
     }
   for (i = 0; i < macnum; ++i)
     {
-      if (!strncmp (argv[1], macros[i].mac_name, 9))
+      if (!strncmp (argv[1], macros[i].mac_name,
+                   sizeof (macros[i].mac_name)))
        {
          break;
        }
diff --git a/ftp/ruserpass.c b/ftp/ruserpass.c
index 1bf9b41..33d99b0 100644
--- a/ftp/ruserpass.c
+++ b/ftp/ruserpass.c
@@ -115,7 +115,8 @@ remote_userpass (char *host, char **aname, char **apass, 
char **aacct)
 {
   char *hdir, buf[BUFSIZ], *tmp;
   char *myname = 0, *mydomain;
-  int t, i, c, usedefault = 0;
+  int t, c, usedefault = 0;
+  size_t i;
   struct stat stb;
 
   hdir = getenv ("HOME");
@@ -238,7 +239,8 @@ remote_userpass (char *host, char **aname, char **apass, 
char **aacct)
                }
              tmp = macros[macnum].mac_name;
              *tmp++ = c;
-             for (i = 0; i < 8 && (c = getc (cfile)) != EOF && !isspace (c);
+             for (i = 0; i < (sizeof (macros[macnum].mac_name) - 1)
+                         && (c = getc (cfile)) != EOF && !isspace (c);
                   ++i)
                {
                  *tmp++ = c;
@@ -267,7 +269,7 @@ remote_userpass (char *host, char **aname, char **apass, 
char **aacct)
                  macros[macnum].mac_start = macros[macnum - 1].mac_end + 1;
                }
              tmp = macros[macnum].mac_start;
-             while (tmp != macbuf + 4096)
+             while (tmp < macbuf + sizeof (macbuf))
                {
                  if ((c = getc (cfile)) == EOF)
                    {
@@ -287,7 +289,7 @@ remote_userpass (char *host, char **aname, char **apass, 
char **aacct)
                    }
                  tmp++;
                }
-             if (tmp == macbuf + 4096)
+             if (tmp == macbuf + sizeof (macbuf))
                {
                  printf ("4K macro buffer exceeded\n");
                  goto bad;

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

Summary of changes:
 ChangeLog          |   14 ++++++++++++++
 doc/inetutils.texi |   26 +++++++++++++++-----------
 ftp/cmds.c         |    5 +++--
 ftp/domacro.c      |    3 ++-
 ftp/ruserpass.c    |   10 ++++++----
 5 files changed, 40 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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