mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 04:45:43 +01:00
ovl: reject lowerdir ending with unescaped backslash
In ovl_parse_param_split_lowerdirs() a backslash consumes the character that follows it. When the backslash is the last character of the lowerdir value, it consumes the NUL terminator: the loop exits normally and the backslash is kept in the output, so the lowerdir is passed downstream with a trailing backslash and the mount fails later with a confusing ENOENT from path lookup. A trailing unescaped backslash escapes nothing, so reject it with EINVAL. Signed-off-by: Guanglei Zhu <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Amir Goldstein <[email protected]> Signed-off-by: Christian Brauner (Amutable) <[email protected]>
This commit is contained in:
1 parent
36ebddca56
commit
99ae7dc439
1 file changed
+3
@@ -216,6 +216,9 @@ static ssize_t ovl_parse_param_split_lowerdirs(char *str)
|
||||
if (*s == '\\') {
|
||||
/* keep esc chars in split lowerdir */
|
||||
*d++ = *s++;
|
||||
/* A trailing backslash escapes nothing. */
|
||||
if (!*s)
|
||||
return -EINVAL;
|
||||
} else if (*s == ':') {
|
||||
bool next_colon = (*(s + 1) == ':');
|
||||
|
||||
|
||||
Reference in new issue
Block a user