rustdesk/rustdesk · error

invalid file name component

Error message

invalid file name component

What it means

Generic guard in validate_no_symlink_components's component loop: a path component of the relative name is not a Normal component (e.g. it is a RootDir, Prefix, ParentDir, or CurDir). Since the function only accepts plain normal segments joined under the base, any such component means the name is not a simple relative path and is rejected. The input at fault is the relative name containing a non-normal path component.

Source

Thrown at libs/base/src/fs.rs:552

                        if meta.file_type().is_symlink() {
                            bail!("symlink path component is not allowed");
                        }
                    }
                    Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
                        // Component does not exist yet, continue best-effort validation.
                    }
                    Err(err) => {
                        bail!(
                            "failed to validate path component '{}': {}",
                            current.display(),
                            err
                        );
                    }
                }
            }
            std::path::Component::CurDir => {}
            _ => {
                bail!("invalid file name component");
            }
        }
    }
    Ok(())
}

/// Validate an untrusted relative file name and existing path components before joining it.
pub fn join_validated_path(base: &PathBuf, name: &str) -> ResultType<PathBuf> {
    validate_file_name_no_traversal(name)?;
    validate_no_symlink_components(base, name)?;
    Ok(TransferJob::join(base, name))
}

impl TransferJob {
    #[allow(clippy::too_many_arguments)]
    pub fn new_write(
        id: i32,
        r#type: JobType,

View on GitHub (pinned to 91c9fccbb0)

Solutions

  1. Send only plain relative file names without '.', '..', roots, or Windows prefixes
  2. Normalize the path client-side and strip leading separators before submitting
  3. Reject the request that carried the malformed name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at libs/base/src/fs.rs:552 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rustdesk/rustdesk@91c9fccbb0 (2026-09-10). Data as JSON: /api/errors/64f251eefb6b6775. Report an issue: GitHub.