diff options
author | Bernd Schmidt <bernds_cb1@t-online.de> | 2009-10-06 04:55:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-10-11 14:33:56 -0400 |
commit | ef1f7a7e878e4ae37b3a78ebdeef9f911bae59df (patch) | |
tree | e73d6e0e852d370effdb9e6fb624e696321683ac /fs/romfs/storage.c | |
parent | c6c599272374a358b4171d50ffd605e6cf7b481c (diff) |
ROMFS: fix length used with romfs_dev_strnlen() function
An interestingly corrupted romfs file system exposed a problem with the
romfs_dev_strnlen function: it's passing the wrong value to its helpers.
Rather than limit the string to the length passed in by the callers, it
uses the size of the device as the limit.
Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/romfs/storage.c')
-rw-r--r-- | fs/romfs/storage.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/romfs/storage.c b/fs/romfs/storage.c index b3208adf8e71..71e2b4d50a0a 100644 --- a/fs/romfs/storage.c +++ b/fs/romfs/storage.c | |||
@@ -253,11 +253,11 @@ ssize_t romfs_dev_strnlen(struct super_block *sb, | |||
253 | 253 | ||
254 | #ifdef CONFIG_ROMFS_ON_MTD | 254 | #ifdef CONFIG_ROMFS_ON_MTD |
255 | if (sb->s_mtd) | 255 | if (sb->s_mtd) |
256 | return romfs_mtd_strnlen(sb, pos, limit); | 256 | return romfs_mtd_strnlen(sb, pos, maxlen); |
257 | #endif | 257 | #endif |
258 | #ifdef CONFIG_ROMFS_ON_BLOCK | 258 | #ifdef CONFIG_ROMFS_ON_BLOCK |
259 | if (sb->s_bdev) | 259 | if (sb->s_bdev) |
260 | return romfs_blk_strnlen(sb, pos, limit); | 260 | return romfs_blk_strnlen(sb, pos, maxlen); |
261 | #endif | 261 | #endif |
262 | return -EIO; | 262 | return -EIO; |
263 | } | 263 | } |