From 61250f78c4f025e308f266bbaea13a43f7302380 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Mon, 18 Feb 2019 08:26:18 +0000 Subject: [PATCH] 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 --- stand/libsa/cd9660.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stand/libsa/cd9660.c b/stand/libsa/cd9660.c index 01fafffb43d8..60b830de483b 100644 --- a/stand/libsa/cd9660.c +++ b/stand/libsa/cd9660.c @@ -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;