From: Adam Buchbinder Date: Sat, 22 Jul 2017 21:52:24 +0000 (-0400) Subject: e2p: fix segfault in e2p_os2string X-Git-Tag: v1.43.5~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44137c3b2607ab21178860c595689353efb54340;p=thirdparty%2Fe2fsprogs.git e2p: fix segfault in e2p_os2string Passing in a negative integer would lead to a segfault, and a crafted filesystem image could trigger that. Signed-off-by: Adam Buchbinder Signed-off-by: Theodore Ts'o --- diff --git a/lib/e2p/ostype.c b/lib/e2p/ostype.c index 7f088446b..c5fd8ab3e 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)";