Changeset 8e77b12f in mainline


Ignore:
Timestamp:
2014-08-04T17:35:40Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d4b63fa
Parents:
f2f4c00
Message:

Skip special CDFS directory entries. Correctly detect the last one.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/cdfs/cdfs_ops.c

    rf2f4c00 r8e77b12f  
    6666#define CDFS_STANDARD_IDENT  "CD001"
    6767
     68enum {
     69        CDFS_NAME_CURDIR = '\x00',
     70        CDFS_NAME_PARENTDIR = '\x01'
     71};
     72
    6873typedef enum {
    6974        VOL_DESC_BOOT = 0,
     
    409414                        return false;
    410415               
    411                 cdfs_dir_t *dir = (cdfs_dir_t *) block->data;
     416                cdfs_dir_t *dir;
    412417               
    413                 // FIXME: skip '.' and '..'
    414                
    415                 for (size_t offset = 0;
    416                     (dir->length != 0) && (offset < BLOCK_SIZE);
     418                for (size_t offset = 0; offset < BLOCK_SIZE;
    417419                    offset += dir->length) {
    418420                        dir = (cdfs_dir_t *) (block->data + offset);
     421                        if (dir->length == 0)
     422                                break;
     423                        if (offset + dir->length > BLOCK_SIZE) {
     424                                /* XXX Incorrect FS structure */
     425                                break;
     426                        }
    419427                       
    420428                        cdfs_dentry_type_t dentry_type;
     
    423431                        else
    424432                                dentry_type = CDFS_FILE;
     433                       
     434                        /* Skip special entries */
     435                       
     436                        if (dir->name_length == 1 &&
     437                            dir->name[0] == CDFS_NAME_CURDIR)
     438                                continue;
     439                        if (dir->name_length == 1 &&
     440                            dir->name[0] == CDFS_NAME_PARENTDIR)
     441                                continue;
    425442                       
    426443                        // FIXME: hack - indexing by dentry byte offset on disc
Note: See TracChangeset for help on using the changeset viewer.