zlacker

[parent] [thread] 2 comments
1. kragen+(OP)[view] [source] 2025-08-23 00:20:25
You can't get null bytes from a command-line argument. And going by >>44991638 it's common to not use OsString when accepting command-line arguments, because std::env::args yields Strings, which means that probably most Rust programs that accept filenames on the command line have this bug.
replies(1): >>adastr+q4
2. adastr+q4[view] [source] 2025-08-23 01:03:08
>>kragen+(OP)
Rust String can contain null bytes! Rust uses explicit string lengths. Agree though that most OS wouldn't be able to pass null bytes in arguments though.
replies(1): >>kragen+a5
◧◩
3. kragen+a5[view] [source] [discussion] 2025-08-23 01:09:33
>>adastr+q4
Right, but it can't contain invalid UTF-8, which is valid in both command-line parameters and in filenames on Linux, FreeBSD, and other normal Unixes. See my link above for a demonstration of how this causes bugs in Rust programs.
[go to top]