Merge branch 'fix-assert' into 'master'

fix: `to_string_lossy` for safer string conversion in `__assert_fail`

Closes #262

See merge request redox-os/relibc!986
This commit is contained in:
Jeremy Soller
2026-02-24 08:13:07 -07:00
+3 -3
View File
@@ -14,9 +14,9 @@ pub unsafe extern "C" fn __assert_fail(
line: c_int,
cond: *const c_char,
) -> ! {
let func = unsafe { CStr::from_ptr(func) }.to_str().unwrap();
let file = unsafe { CStr::from_ptr(file) }.to_str().unwrap();
let cond = unsafe { CStr::from_ptr(cond) }.to_str().unwrap();
let func = unsafe { CStr::from_ptr(func) }.to_string_lossy();
let file = unsafe { CStr::from_ptr(file) }.to_string_lossy();
let cond = unsafe { CStr::from_ptr(cond) }.to_string_lossy();
eprintln!("{}: {}:{}: Assertion `{}` failed.", func, file, line, cond);