From: Adam Buchbinder <abuchbinder@google.com>
To: linux-ext4@vger.kernel.org
Cc: Adam Buchbinder <abuchbinder@google.com>
Subject: [PATCH v2 1/2] e2p: Fix segfault in e2p_os2string.
Date: Tue, 18 Jul 2017 14:48:22 -0700 [thread overview]
Message-ID: <20170718214823.22649-2-abuchbinder@google.com> (raw)
In-Reply-To: <20170718214823.22649-1-abuchbinder@google.com>
Passing in a negative integer would lead to a segfault, and
a crafted filesystem image could trigger that.
Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
---
lib/e2p/ostype.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/e2p/ostype.c b/lib/e2p/ostype.c
index 7f088446..c5fd8ab3 100644
--- a/lib/e2p/ostype.c
+++ b/lib/e2p/ostype.c
@@ -30,7 +30,7 @@ char *e2p_os2string(int os_type)
const char *os;
char *ret;
- if (os_type <= EXT2_OS_LITES)
+ if (os_type >= 0 && os_type <= EXT2_OS_LITES)
os = os_tab[os_type];
else
os = "(unknown os)";
--
2.14.0.rc0.284.gd933b75aa4-goog
next prev parent reply other threads:[~2017-07-18 21:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 19:29 [PATCH 0/2] Handle invalid os_type in e2p Adam Buchbinder
2017-07-18 19:29 ` [PATCH 1/2] tests: dumpe2fs against an image with bad os_type Adam Buchbinder
2017-07-18 20:06 ` Andreas Dilger
2017-07-18 19:29 ` [PATCH 2/2] e2p: Fix segfault in e2p_os2string Adam Buchbinder
2017-07-18 20:04 ` Andreas Dilger
2017-07-18 21:48 ` [PATCH v2 0/2] Handle invalid os_type in e2p Adam Buchbinder
2017-07-18 21:48 ` Adam Buchbinder [this message]
2017-07-18 22:32 ` [PATCH v2 1/2] e2p: Fix segfault in e2p_os2string Andreas Dilger
2017-07-22 21:57 ` Theodore Ts'o
2017-07-18 21:48 ` [PATCH v2 2/2] tests: dumpe2fs against an image with bad os_type Adam Buchbinder
2017-07-18 22:32 ` Andreas Dilger
2017-07-22 21:57 ` 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=20170718214823.22649-2-abuchbinder@google.com \
--to=abuchbinder@google.com \
--cc=linux-ext4@vger.kernel.org \
/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).