Changeset 41bbab6 in mainline


Ignore:
Timestamp:
2018-03-26T15:26:44Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
92cf9a4
Parents:
81b1db8
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-26 15:21:43)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-26 15:26:44)
Message:

Check for path length overflow in rm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    r81b1db8 r41bbab6  
    174174        memset(buff, 0, sizeof(buff));
    175175        while ((dp = readdir(dirp))) {
    176                 snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name);
     176                int len = snprintf(buff, PATH_MAX - 1, "%s/%s", path, dp->d_name);
     177                if (len > PATH_MAX-1) {
     178                        // TODO: Do not enforce arbitrary static limits.
     179                        cli_error(CL_EFAIL, "Path too long for %s/%s", path, dp->d_name);
     180                        continue;
     181                }
    177182                scope = rm_scope(buff);
    178183                switch (scope) {
Note: See TracChangeset for help on using the changeset viewer.