From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org,
Gabriel Krisman Bertazi <krisman@collabora.com>
Subject: [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup
Date: Sat, 13 Apr 2019 01:43:11 -0400 [thread overview]
Message-ID: <20190413054317.7388-5-krisman@collabora.com> (raw)
In-Reply-To: <20190413054317.7388-1-krisman@collabora.com>
Delay the access of data->offset until after the null check. This was
reported by 0-day on the kernel version of the script.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
lib/ext2fs/nls_utf8-norm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/ext2fs/nls_utf8-norm.c b/lib/ext2fs/nls_utf8-norm.c
index 5a91573f766f..4230b64bc586 100644
--- a/lib/ext2fs/nls_utf8-norm.c
+++ b/lib/ext2fs/nls_utf8-norm.c
@@ -335,7 +335,7 @@ utf8hangul(const char *str, unsigned char *hangul)
static utf8leaf_t *utf8nlookup(const struct utf8data *data,
unsigned char *hangul, const char *s, size_t len)
{
- utf8trie_t *trie = utf8data + data->offset;
+ utf8trie_t *trie = NULL;
int offlen;
int offset;
int mask;
@@ -345,6 +345,8 @@ static utf8leaf_t *utf8nlookup(const struct utf8data *data,
return NULL;
if (len == 0)
return NULL;
+
+ trie = utf8data + data->offset;
node = 1;
while (node) {
offlen = (*trie & OFFLEN) >> OFFLEN_SHIFT;
--
2.20.1
next prev parent reply other threads:[~2019-04-13 5:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-13 5:43 [PATCH e2fsprogs 00/10] case-insensitive feature updates Gabriel Krisman Bertazi
2019-04-13 5:43 ` [PATCH e2fsprogs 01/10] e2p: encoding: Fix default flags lookup Gabriel Krisman Bertazi
2019-04-28 19:04 ` Theodore Ts'o
2019-04-13 5:43 ` [PATCH e2fsprogs 02/10] ext2fs: Always attempt to load nls table when loading the filesystem Gabriel Krisman Bertazi
2019-04-28 19:06 ` Theodore Ts'o
2019-04-13 5:43 ` Gabriel Krisman Bertazi [this message]
2019-04-28 19:11 ` [PATCH e2fsprogs 04/10] ext2fs: nls: Fix potential null dereference in utf8nlookup Theodore Ts'o
2019-04-13 5:43 ` [PATCH e2fsprogs 05/10] ext2fs: nls: Merge sparse fixes from the kernel version Gabriel Krisman Bertazi
2019-04-28 19:12 ` Theodore Ts'o
2019-04-13 5:43 ` [PATCH e2fsprogs 07/10] ext2fs: Don't normalize names on -F directories Gabriel Krisman Bertazi
2019-04-28 20:45 ` Theodore Ts'o
2019-04-13 5:43 ` [PATCH e2fsprogs 08/10] ext2fs: nls: Drop normalization code Gabriel Krisman Bertazi
2019-04-28 20:48 ` Theodore Ts'o
2019-05-02 16:25 ` Change feature name from fname_encoding to casefold? Theodore Ts'o
2019-05-02 17:03 ` Gabriel Krisman Bertazi
2019-05-02 20:50 ` Darrick J. Wong
2019-05-02 21:46 ` Gabriel Krisman Bertazi
2019-04-13 5:43 ` [PATCH e2fsprogs 09/10] ext2fs: nls: Drop ascii NLS support Gabriel Krisman Bertazi
2019-04-28 20:52 ` Theodore Ts'o
2019-04-13 5:43 ` [PATCH e2fsprogs 10/10] ext4.5.in: Document design changes on the casefold attribute Gabriel Krisman Bertazi
2019-04-29 1:00 ` Theodore Ts'o
[not found] ` <20190413054317.7388-4-krisman@collabora.com>
2019-04-28 19:09 ` [PATCH e2fsprogs 03/10] ext2fs: nls: Convert NFKD -> NFD Theodore Ts'o
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=20190413054317.7388-5-krisman@collabora.com \
--to=krisman@collabora.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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).