net_util: replace as <pointer> casts with safer alternatives

`as` casts can change mutability, which quickly leads to undefined
behavior.

Signed-off-by: Julian Schindel <mail@arctic-alpaca.de>
This commit is contained in:
Julian Schindel
2026-04-29 21:55:06 +02:00
committed by Rob Bradford
parent 6de472f1bb
commit 2a6b746f5e
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -169,7 +169,7 @@ impl Tap {
// Open calls are safe because we give a constant null-terminated
// string and verify the result.
libc::open(
c"/dev/net/tun".as_ptr() as *const c_char,
c"/dev/net/tun".as_ptr().cast(),
flags.unwrap_or(libc::O_RDWR | libc::O_NONBLOCK | libc::O_CLOEXEC),
)
};