Changeset 8c3cd1e8 in rtems


Ignore:
Timestamp:
Oct 30, 2018, 10:34:16 AM (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
fa0adf36
Parents:
706802f8
git-author:
Sebastian Huber <sebastian.huber@…> (10/30/18 10:34:16)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/30/18 12:27:03)
Message:

ftpd: Deal with too long command lines

Update #3530.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ftpd/ftpd.c

    r706802f8 r8c3cd1e8  
    19091909        char buf[FTPD_BUFSIZE];
    19101910        char *cmd, *opts, *args;
     1911        size_t len;
    19111912
    19121913        if (fgets(buf, FTPD_BUFSIZE, info->ctrl_fp) == NULL)
    19131914        {
    19141915          syslog(LOG_INFO, "ftpd: Connection aborted.");
     1916          break;
     1917        }
     1918
     1919        len = strlen(buf);
     1920
     1921        if (len == 0)
     1922          continue;
     1923
     1924        if (buf[len - 1] != '\n')
     1925        {
     1926          send_reply(info, 501, "Command line too long.");
     1927
     1928          /*
     1929           * We could also try to continue here, however, discarding the rest
     1930           * of the current command line and figuring out when the next command
     1931           * starts with fgets() is not that easy.  It would be better to avoid
     1932           * the FILE stream and just use the socket directly with send() and
     1933           * recv().
     1934           */
    19151935          break;
    19161936        }
Note: See TracChangeset for help on using the changeset viewer.