VYPR
Medium severity5.5NVD Advisory· Published Apr 22, 2026· Updated Apr 29, 2026

CVE-2026-35380

CVE-2026-35380

Description

A logic error in the cut utility of uutils coreutils causes the program to incorrectly interpret the literal two-byte string '' (two single quotes) as an empty delimiter. The implementation mistakenly maps this string to the NUL character for both the -d (delimiter) and --output-delimiter options. This vulnerability can lead to silent data corruption or logic errors in automated scripts and data pipelines that process strings containing these characters, as the utility may unintentionally split or join data on NUL bytes rather than the intended literal characters.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
coreutilscrates.io
< 0.8.00.8.0

Affected products

1

Patches

1
593f5b191e8b

cut: reject literal '' delimiter special-casing

https://github.com/uutils/coreutilscan1357Mar 18, 2026via ghsa
2 files changed · +27 9
  • src/uu/cut/src/cut.rs+2 3 modified
    @@ -511,8 +511,7 @@ fn get_delimiters(matches: &ArgMatches) -> UResult<(Delimiter<'_>, Option<&[u8]>
                 ));
             }
             Some(os_string) => {
    -            if os_string == "''" || os_string.is_empty() {
    -                // treat `''` as empty delimiter
    +            if os_string.is_empty() {
                     Delimiter::Slice(b"\0")
                 } else {
                     // For delimiter `-d` option value - allow both UTF-8 (possibly multi-byte) characters
    @@ -540,7 +539,7 @@ fn get_delimiters(matches: &ArgMatches) -> UResult<(Delimiter<'_>, Option<&[u8]>
         let out_delim = matches
             .get_one::<OsString>(options::OUTPUT_DELIMITER)
             .map(|os_string| {
    -            if os_string.is_empty() || os_string == "''" {
    +            if os_string.is_empty() {
                     b"\0"
                 } else {
                     os_str_as_bytes(os_string).unwrap()
    
  • tests/by-util/test_cut.rs+25 6 modified
    @@ -263,24 +263,43 @@ fn test_equal_as_delimiter() {
     
     #[test]
     fn test_empty_string_as_delimiter() {
    -    for arg in ["-d''", "--delimiter=", "--delimiter=''"] {
    +    new_ucmd!()
    +        .args(&["-f2", "--delimiter="])
    +        .pipe_in("a\0b\n")
    +        .succeeds()
    +        .stdout_only("b\n");
    +}
    +
    +#[test]
    +fn test_single_quote_pair_as_delimiter_is_invalid() {
    +    for args in [&["-d", "''", "-f2"][..], &["--delimiter=''", "-f2"][..]] {
             new_ucmd!()
    -            .args(&["-f2", arg])
    -            .pipe_in("a\0b\n")
    -            .succeeds()
    -            .stdout_only("b\n");
    +            .args(args)
    +            .pipe_in("a''b\n")
    +            .fails()
    +            .stderr_contains("cut: the delimiter must be a single character")
    +            .no_stdout();
         }
     }
     
     #[test]
     fn test_empty_string_as_delimiter_with_output_delimiter() {
         new_ucmd!()
    -        .args(&["-f", "1,2", "-d", "''", "--output-delimiter=Z"])
    +        .args(&["-f", "1,2", "--delimiter=", "--output-delimiter=Z"])
             .pipe_in("ab\0cd\n")
             .succeeds()
             .stdout_only_bytes("abZcd\n");
     }
     
    +#[test]
    +fn test_single_quote_pair_as_output_delimiter_is_literal() {
    +    new_ucmd!()
    +        .args(&["-f", "1,2", "-d:", "--output-delimiter=''"])
    +        .pipe_in("ab:cd\n")
    +        .succeeds()
    +        .stdout_only_bytes("ab''cd\n");
    +}
    +
     #[test]
     fn test_newline_as_delimiter() {
         for (field, expected_output) in [("1", "a:1\n"), ("2", "b:\n")] {
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

2