diff mbox series

libext2fs: add missing check for utf8lookup()'s return value

Message ID 20190510182053.23819-1-tytso@mit.edu
State Accepted, archived
Headers show
Series libext2fs: add missing check for utf8lookup()'s return value | expand

Commit Message

Theodore Ts'o May 10, 2019, 6:20 p.m. UTC
Fixes-Coverity-Bug: 1442630
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 lib/ext2fs/nls_utf8.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Gabriel Krisman Bertazi May 12, 2019, 2:38 a.m. UTC | #1
"Theodore Ts'o" <tytso@mit.edu> writes:

> Fixes-Coverity-Bug: 1442630
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Cc: Gabriel Krisman Bertazi <krisman@collabora.com>
> ---
>  lib/ext2fs/nls_utf8.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>

We should get this applied on the kernel side as well.

Thanks,
diff mbox series

Patch

diff --git a/lib/ext2fs/nls_utf8.c b/lib/ext2fs/nls_utf8.c
index 42148099a..e4c4e7a30 100644
--- a/lib/ext2fs/nls_utf8.c
+++ b/lib/ext2fs/nls_utf8.c
@@ -789,6 +789,8 @@  static int utf8byte(struct utf8cursor *u8c)
 			}
 
 			leaf = utf8lookup(u8c->data, u8c->hangul, u8c->s);
+			if (!leaf)
+				return -1;
 			ccc = LEAF_CCC(leaf);
 		}