cd9660: dirmatch fails to unmatch when name is prefix for directory record

Loader does fail to properly match the file name in directory record and
does open file based on prefix match.

For fix, we check the name lengths first.

Reviewed by:	allanjude
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D19213
This commit is contained in:
Toomas Soome 2019-02-18 08:26:18 +00:00
parent 5a75fc4b11
commit 61250f78c4

View File

@ -241,6 +241,10 @@ dirmatch(struct open_file *f, const char *path, struct iso_directory_record *dp,
icase = 1;
} else
icase = 0;
if (strlen(path) != len)
return (0);
for (i = len; --i >= 0; path++, cp++) {
if (!*path || *path == '/')
break;