Changeset 5bd75823 in rtems for cpukit


Ignore:
Timestamp:
Oct 8, 2018, 8:02:07 AM (12 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
acb53d5
Parents:
2f784d7
git-author:
Sebastian Huber <sebastian.huber@…> (10/08/18 08:02:07)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/08/18 08:06:44)
Message:

ftpd: Remove superfluous temporary buffer

Update #3530.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ftpd/ftpd.c

    r2f784d7 r5bd75823  
    523523 */
    524524static void
    525 send_reply(FTPD_SessionInfo_t  *info, int code, char *text)
     525send_reply(FTPD_SessionInfo_t  *info, int code, const char *text)
    526526{
    527527  text = text != NULL ? text : "";
     
    13071307 */
    13081308static void
    1309 command_cwd(FTPD_SessionInfo_t  *info, char *dir)
     1309command_cwd(FTPD_SessionInfo_t  *info, const char *dir)
    13101310{
    13111311  if(!info->auth)
     
    16731673 */
    16741674static void
    1675 exec_command(FTPD_SessionInfo_t *info, char* cmd, char* args)
    1676 {
    1677   char fname[FTPD_BUFSIZE];
     1675exec_command(FTPD_SessionInfo_t *info, char *cmd, char *args)
     1676{
    16781677  int wrong_command = 0;
    16791678
    1680   fname[0] = '\0';
    1681 
    16821679  if (!strcmp("PORT", cmd))
    16831680  {
     
    16901687  else if (!strcmp("RETR", cmd))
    16911688  {
    1692     strncpy(fname, args, 254);
    1693     command_retrieve(info, fname);
     1689    command_retrieve(info, args);
    16941690  }
    16951691  else if (!strcmp("STOR", cmd))
    16961692  {
    1697     strncpy(fname, args, 254);
    1698     command_store(info, fname);
     1693    command_store(info, args);
    16991694  }
    17001695  else if (!strcmp("LIST", cmd))
    17011696  {
    1702     strncpy(fname, args, 254);
    1703     command_list(info, fname, 1);
     1697    command_list(info, args, 1);
    17041698  }
    17051699  else if (!strcmp("NLST", cmd))
    17061700  {
    1707     strncpy(fname, args, 254);
    1708     command_list(info, fname, 0);
     1701    command_list(info, args, 0);
    17091702  }
    17101703  else if (!strcmp("MDTM", cmd))
    17111704  {
    1712     strncpy(fname, args, 254);
    1713     command_mdtm(info, fname);
     1705    command_mdtm(info, args);
    17141706  }
    17151707  else if (!strcmp("SIZE", cmd))
    17161708  {
    1717     strncpy(fname, args, 254);
    1718     command_size(info, fname);
     1709    command_size(info, args);
    17191710  }
    17201711  else if (!strcmp("SYST", cmd))
     
    17741765      send_reply(info, 550, "Access denied.");
    17751766    }
    1776     else if (
    1777       strncpy(fname, args, 254) &&
    1778       unlink(fname) == 0)
     1767    else if (unlink(args) == 0)
    17791768    {
    17801769      send_reply(info, 257, "DELE successful.");
     
    18001789        char *c;
    18011790        c = strchr(args, ' ');
    1802         if((c != NULL) && (sscanf(args, "%o", &mask) == 1) && strncpy(fname, c+1, 254)
    1803           && (chmod(fname, (mode_t)mask) == 0))
     1791        if((c != NULL) && (sscanf(args, "%o", &mask) == 1)
     1792          && (chmod(c + 1, (mode_t)mask) == 0))
    18041793          send_reply(info, 257, "CHMOD successful.");
    18051794        else
     
    18161805      send_reply(info, 550, "Access denied.");
    18171806    }
    1818     else if (
    1819       strncpy(fname, args, 254) &&
    1820       rmdir(fname) == 0)
     1807    else if (rmdir(args) == 0)
    18211808    {
    18221809      send_reply(info, 257, "RMD successful.");
     
    18331820      send_reply(info, 550, "Access denied.");
    18341821    }
    1835     else if (
    1836       strncpy(fname, args, 254) &&
    1837       mkdir(fname, S_IRWXU | S_IRWXG | S_IRWXO) == 0)
     1822    else if (mkdir(args, S_IRWXU | S_IRWXG | S_IRWXO) == 0)
    18381823    {
    18391824      send_reply(info, 257, "MKD successful.");
     
    18461831  else if (!strcmp("CWD", cmd))
    18471832  {
    1848     strncpy(fname, args, 254);
    1849     command_cwd(info, fname);
     1833    command_cwd(info, args);
    18501834  }
    18511835  else if (!strcmp("CDUP", cmd))
Note: See TracChangeset for help on using the changeset viewer.