{"record":{"id":"0be3c2d5172cc113","repo":"Morganamilo/paru","slug":"value-can-not-contain-null-bytes","errorCode":null,"errorMessage":"value can not contain null bytes","messagePattern":"value can not contain null bytes","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/config.rs","lineNumber":992,"sourceCode":"\n        match key {\n            \"Url\" => repo.source.set_url(Url::parse(value?)?),\n            \"Path\" => repo.source.set_path(value?.to_string()),\n            \"Depth\" => repo.depth = value?.parse()?,\n            \"SkipReview\" => repo.skip_review = true,\n            \"GenerateSrcinfo\" => repo.force_srcinfo = true,\n            _ => eprintln!(\"{}\", tr!(\"error: unknown option '{}' in repo\", key)),\n        }\n\n        Ok(())\n    }\n\n    fn parse_env(&mut self, key: &str, value: Option<&str>) -> Result<()> {\n        let value = value.context(tr!(\"key can not be empty\"))?;\n\n        ensure!(!key.is_empty(), tr!(\"key can not be empty\"));\n        ensure!(!key.contains('\\0'), tr!(\"key can not contain null bytes\"));\n        ensure!(\n            !value.contains('\\0'),\n            tr!(\"value can not contain null bytes\")\n        );\n\n        self.env.push((key.to_owned(), value.to_string()));\n        set_var(key, value);\n        Ok(())\n    }\n\n    fn parse_bin(&mut self, key: &str, value: Option<&str>) -> Result<()> {\n        let value = value\n            .map(|s| s.to_string())\n            .ok_or_else(|| anyhow!(tr!(\"key can not be empty\")))?;\n\n        let split = value.split_whitespace().map(|s| s.to_string());\n\n        match key {\n            \"Makepkg\" => self.makepkg_bin = value,","sourceCodeStart":974,"sourceCodeEnd":1010,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/config.rs#L974-L1010","documentation":"parse_env rejects environment variable values containing a NUL ('\\0') byte. Environment values passed to child processes via set_var/execve cannot contain NUL, so the library validates the value before storing it and exporting it with set_var.","triggerScenarios":"A value parsed from the config [env] section contains '\\0', e.g. a corrupted config file or wrongly interpolated binary content.","commonSituations":"Config files corrupted by binary writes; env values generated from program output containing NULs (e.g. find -print0 output pasted raw).","solutions":["Fix or remove the [env] entry containing the null byte (grep -P '\\x00' paru.conf)","Regenerate the value using newline-terminated output instead of NUL-delimited output","Validate the config file as clean UTF-8 text"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn valid_env_value(value: &str) -> bool {\n    !value.contains('\\0')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid piping NUL-delimited output (find -print0) directly into env values","Sanitize env values sourced from program output","Validate config text encoding before parsing"],"tags":["config","env","validation","encoding"],"backgroundTag":"invalid-argument-format","analyzedSha":"9ac3578807a87858651e81a02586ceb947686e7c","analyzedAt":"2026-09-12T04:57:59.861Z","contentChangedAt":"2026-09-12T04:57:59.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}