From 2aee23f325037fce1db32d556e6cf9adaa97ce04 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 12 Nov 2006 10:40:40 -0500 Subject: [PATCH] Allow unix_io offsets greater than 2G Addresses SourceForge Bug: #1547922 Signed-off-by: "Theodore Ts'o" --- lib/ext2fs/ChangeLog | 5 +++++ lib/ext2fs/unix_io.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 51a2f3a..8e5e8c0 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,8 @@ +2006-11-12 Theodore Tso + + * unix_io.c (unix_flush): Allow offsets greater than 2G. + (Addresses SourceForge Bug #1547922) + 2006-11-11 Theodore Tso * dirhash.c (str2hashbuf, ext2fs_dirhash): Add support for diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index fb33c16..4ede000 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -691,7 +691,7 @@ static errcode_t unix_set_option(io_channel channel, const char *option, const char *arg) { struct unix_private_data *data; - unsigned long tmp; + unsigned long long tmp; char *end; EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); @@ -702,10 +702,12 @@ static errcode_t unix_set_option(io_channel channel, const char *option, if (!arg) return EXT2_ET_INVALID_ARGUMENT; - tmp = strtoul(arg, &end, 0); + tmp = strtoull(arg, &end, 0); if (*end) return EXT2_ET_INVALID_ARGUMENT; data->offset = tmp; + if (data->offset < 0) + return EXT2_ET_INVALID_ARGUMENT; return 0; } return EXT2_ET_INVALID_ARGUMENT; -- 1.8.3.1