The function isofile_gen_utility_names could resolve .. directory
entries in a way that dirname will start with "../". If this happens,
the while-loop is unable to detect this because it forwards until the
cursor detects a slash again.
Fix this by also taking "../" at the beginning into account. Such an
entry can happen if "../../" points before the top directory.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
}
} else
p++;
+ } else if (p == dirname && p[0] == '.' && p[1] == '.' && p[2] == '/') {
+ size_t off;
+ for (off = 3; p[off] == '/'; off++)
+ ;
+ memmove(dirname, p + off, strlen(p + off) + 1);
+ p = dirname;
} else
p++;
}