yaffs direct: Modify lseek value checking
authorCharles Manning <cdhmanning@gmail.com>
Wed, 17 Nov 2010 03:19:51 +0000 (16:19 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Wed, 17 Nov 2010 03:20:53 +0000 (16:20 +1300)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffsfs.c

index a970577..f32808d 100644 (file)
@@ -1192,10 +1192,12 @@ off_t yaffs_lseek(int fd, off_t offset, int whence)
                                pos = fSize + offset;
                } 
 
-               if(pos >= 0)
+               if(pos >= 0 && pos <= YAFFS_MAX_FILE_SIZE)
                        h->position = pos;
-               else
+               else{
                        yaffsfs_SetError(-EINVAL);
+                       pos = -1;
+               }
        }
 
        yaffsfs_Unlock();