diff options
Diffstat (limited to 'cpukit/ftpd/ftpd.c')
-rw-r--r-- | cpukit/ftpd/ftpd.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cpukit/ftpd/ftpd.c b/cpukit/ftpd/ftpd.c index eb87612bb5..8aef440a72 100644 --- a/cpukit/ftpd/ftpd.c +++ b/cpukit/ftpd/ftpd.c @@ -1908,6 +1908,7 @@ session(rtems_task_argument arg) { char buf[FTPD_BUFSIZE]; char *cmd, *opts, *args; + size_t len; if (fgets(buf, FTPD_BUFSIZE, info->ctrl_fp) == NULL) { @@ -1915,6 +1916,25 @@ session(rtems_task_argument arg) break; } + len = strlen(buf); + + if (len == 0) + continue; + + if (buf[len - 1] != '\n') + { + send_reply(info, 501, "Command line too long."); + + /* + * We could also try to continue here, however, discarding the rest + * of the current command line and figuring out when the next command + * starts with fgets() is not that easy. It would be better to avoid + * the FILE stream and just use the socket directly with send() and + * recv(). + */ + break; + } + split_command(buf, &cmd, &opts, &args); if (!strcmp("QUIT", cmd)) |