Changeset e303adf in rtems


Ignore:
Timestamp:
Feb 9, 2012, 9:53:16 AM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
23c6f93a
Parents:
28860ec0
git-author:
Sebastian Huber <sebastian.huber@…> (02/09/12 09:53:16)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/09/12 10:05:18)
Message:

Check that the file offset is valid after a seek

Location:
cpukit/libfs/src/dosfs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/dosfs/msdos_dir.c

    r28860ec0 re303adf  
    501501msdos_dir_lseek(rtems_libio_t *iop, off_t offset, int whence)
    502502{
    503     switch (whence)
    504     {
    505         case SEEK_SET:
    506         case SEEK_CUR:
    507             break;
    508         /*
    509          * Movement past the end of the directory via lseek is not a
    510          * permitted operation
    511          */
    512         case SEEK_END:
    513         default:
    514             rtems_set_errno_and_return_minus_one( EINVAL );
    515             break;
    516     }
    517     return RC_OK;
     503    if (iop->offset >= 0 && iop->offset <= iop->size) {
     504        return 0;
     505    } else {
     506        rtems_set_errno_and_return_minus_one(EINVAL);
     507    }
    518508}
    519509
  • cpukit/libfs/src/dosfs/msdos_file.c

    r28860ec0 re303adf  
    231231    fat_file_fd_t     *fat_fd = iop->pathinfo.node_access;
    232232    uint32_t           real_size = 0;
     233
     234    if (iop->offset < 0 || iop->offset > UINT32_MAX) {
     235        rtems_set_errno_and_return_minus_one(EINVAL);
     236    }
    233237
    234238    sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT,
Note: See TracChangeset for help on using the changeset viewer.