changeset 1601:d708ea3b49d2

Merge from MTD (minor safety check)
author gthomas
date Wed, 21 Apr 2004 18:51:20 +0000
parents f98ccb45a59c
children e55ad990e617
files packages/fs/jffs2/current/ChangeLog packages/fs/jffs2/current/src/fs-ecos.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/packages/fs/jffs2/current/ChangeLog
+++ b/packages/fs/jffs2/current/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-21  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/fs-ecos.c: Merge from public MTD - verify file position
+	after each operation (safety check).
+
 2004-04-06  Andrew Lunn  <andrew.lunn@ascom.ch>
 
 	* src/fs-ecos.c (jffs2_extend_file): Fix creation of hole inode's
--- a/packages/fs/jffs2/current/src/fs-ecos.c
+++ b/packages/fs/jffs2/current/src/fs-ecos.c
@@ -8,7 +8,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: fs-ecos.c,v 1.36 2004/04/01 03:39:55 gthomas Exp $
+ * $Id: fs-ecos.c,v 1.37 2004/04/21 18:45:54 gthomas Exp $
  *
  */
 
@@ -1418,6 +1418,11 @@ static int jffs2_fo_lseek(struct CYG_FIL
 		return EINVAL;
 	}
 
+        // Check that pos is still within current file size, or at the
+        // very end.
+        if (pos < 0 || pos > node->i_size)
+                return EINVAL;
+
 	// All OK, set fp offset and return new position.
 	*apos = fp->f_offset = pos;