diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-02-09 10:53:16 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-02-09 11:05:18 +0100 |
commit | e303adf4445919d4d87e8467854c404f9bd0d076 (patch) | |
tree | 5b98af999c6e135b4a4ec1370f8922a7afb5bc5f /cpukit/libfs/src/dosfs/msdos_file.c | |
parent | Fixed warnings and minor bugs (diff) | |
download | rtems-e303adf4445919d4d87e8467854c404f9bd0d076.tar.bz2 |
Check that the file offset is valid after a seek
Diffstat (limited to '')
-rw-r--r-- | cpukit/libfs/src/dosfs/msdos_file.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cpukit/libfs/src/dosfs/msdos_file.c b/cpukit/libfs/src/dosfs/msdos_file.c index b0eeba97bf..5378a25914 100644 --- a/cpukit/libfs/src/dosfs/msdos_file.c +++ b/cpukit/libfs/src/dosfs/msdos_file.c @@ -231,6 +231,10 @@ msdos_file_lseek(rtems_libio_t *iop, off_t offset, int whence) fat_file_fd_t *fat_fd = iop->pathinfo.node_access; uint32_t real_size = 0; + if (iop->offset < 0 || iop->offset > UINT32_MAX) { + rtems_set_errno_and_return_minus_one(EINVAL); + } + sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, MSDOS_VOLUME_SEMAPHORE_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) |