From: Theodore Ts'o Date: Fri, 11 Nov 2016 23:38:20 +0000 (-0500) Subject: libext2fs: avoid dereferencing beyond allocated memory in xattr code X-Git-Tag: 1.43.4~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=689b7be2da01;p=thirdparty%2Fe2fsprogs.git libext2fs: avoid dereferencing beyond allocated memory in xattr code Detected by ASAN. Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c index e8fd10c29..5eeb940d1 100644 --- a/lib/ext2fs/ext_attr.c +++ b/lib/ext2fs/ext_attr.c @@ -308,7 +308,7 @@ static int find_ea_index(char *fullname, char **name, int *index) struct ea_name_index *e; for (e = ea_names; e->name; e++) { - if (memcmp(fullname, e->name, strlen(e->name)) == 0) { + if (strncmp(fullname, e->name, strlen(e->name)) == 0) { *name = (char *)fullname + strlen(e->name); *index = e->index; return 1;