Skip to content

Commit d8d85b9

Browse files
committed
validate whether addr is null before constructing slice
Signed-off-by: YangKeao <[email protected]>
1 parent 0760534 commit d8d85b9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/addr_validate.rs

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ fn open_pipe() -> nix::Result<()> {
5959
}
6060

6161
pub fn validate(addr: *const libc::c_void) -> bool {
62+
if addr.is_null() {
63+
return false
64+
}
65+
6266
const CHECK_LENGTH: usize = 2 * size_of::<*const libc::c_void>() / size_of::<u8>();
6367

6468
// read data in the pipe

0 commit comments

Comments
 (0)