summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/autofs/common.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c
index 1d1117c..cefbcc8 100644
--- a/usr.sbin/autofs/common.c
+++ b/usr.sbin/autofs/common.c
@@ -673,11 +673,21 @@ node_find(struct node *node, const char *path)
{
struct node *child, *found;
char *tmp;
+ size_t tmplen;
//log_debugx("looking up %s in %s", path, node->n_key);
tmp = node_path(node);
- if (strncmp(tmp, path, strlen(tmp)) != 0) {
+ tmplen = strlen(tmp);
+ if (strncmp(tmp, path, tmplen) != 0) {
+ free(tmp);
+ return (NULL);
+ }
+ if (path[tmplen] != '/' && path[tmplen] != '\0') {
+ /*
+ * If we have two map entries like 'foo' and 'foobar', make
+ * sure the search for 'foobar' won't match 'foo' instead.
+ */
free(tmp);
return (NULL);
}
OpenPOWER on IntegriCloud