From: Eric Biggers <ebiggers@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 1/3] f2fs: fix buffer overruns in FS_IOC_{GET, SET}FSLABEL
Date: Thu, 15 Aug 2019 22:55:37 -0700 [thread overview]
Message-ID: <20190816055539.30420-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20190816055539.30420-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
utf16s_to_utf8s() and utf8s_to_utf16s() take the number of characters,
not the number of bytes.
Fixes: 61a3da4d5ef8 ("f2fs: support FS_IOC_{GET,SET}FSLABEL")
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/f2fs/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index eb1aa9b75eda..d521a582d94d 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3094,7 +3094,7 @@ static int f2fs_get_volume_name(struct file *filp, unsigned long arg)
down_read(&sbi->sb_lock);
count = utf16s_to_utf8s(sbi->raw_super->volume_name,
- sizeof(sbi->raw_super->volume_name),
+ ARRAY_SIZE(sbi->raw_super->volume_name),
UTF16_LITTLE_ENDIAN, vbuf, MAX_VOLUME_NAME);
up_read(&sbi->sb_lock);
@@ -3139,7 +3139,7 @@ static int f2fs_set_volume_name(struct file *filp, unsigned long arg)
sizeof(sbi->raw_super->volume_name));
utf8s_to_utf16s(vbuf, MAX_VOLUME_NAME, UTF16_LITTLE_ENDIAN,
sbi->raw_super->volume_name,
- sizeof(sbi->raw_super->volume_name));
+ ARRAY_SIZE(sbi->raw_super->volume_name));
err = f2fs_commit_super(sbi, false);
--
2.22.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2019-08-16 5:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 5:55 [f2fs-dev] [PATCH 0/3] f2fs: fixes for FS_IOC_{GET,SET}FSLABEL Eric Biggers
2019-08-16 5:55 ` Eric Biggers [this message]
2019-08-16 6:50 ` [f2fs-dev] [PATCH 1/3] f2fs: fix buffer overruns in FS_IOC_{GET, SET}FSLABEL Chao Yu
2019-08-16 5:55 ` [f2fs-dev] [PATCH 2/3] f2fs: fix copying too many bytes in FS_IOC_SETFSLABEL Eric Biggers
2019-08-16 6:59 ` Chao Yu
2019-08-18 15:41 ` Eric Biggers
2019-08-19 1:33 ` Chao Yu
2019-08-19 1:58 ` Chao Yu
2019-08-19 2:55 ` Eric Biggers
2019-08-19 3:24 ` Chao Yu
2019-08-16 5:55 ` [f2fs-dev] [PATCH 3/3] f2fs: add missing authorization check " Eric Biggers
2019-08-16 7:00 ` Chao Yu
2019-08-16 6:49 ` [f2fs-dev] [PATCH 0/3] f2fs: fixes for FS_IOC_{GET,SET}FSLABEL Chao Yu
2019-08-18 13:03 ` Chao Yu
2019-08-18 15:42 ` Eric Biggers
2019-08-19 3:03 ` Jaegeuk Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190816055539.30420-2-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).