Skip to content

Commit 26e1b6d

Browse files
author
Mathias Svensson
committed
Fixed a bug where UnixAddr::new_abstract forgot to count the null-byte.
1 parent 3c8ff4a commit 26e1b6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sys/socket/addr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ impl UnixAddr {
391391
.. mem::zeroed()
392392
};
393393

394-
if path.len() > ret.sun_path.len() {
394+
if path.len() + 1 > ret.sun_path.len() {
395395
return Err(Error::Sys(Errno::ENAMETOOLONG));
396396
}
397397

@@ -401,7 +401,7 @@ impl UnixAddr {
401401
ret.sun_path.as_mut_ptr().offset(1) as *mut u8,
402402
path.len());
403403

404-
Ok(UnixAddr(ret, path.len()))
404+
Ok(UnixAddr(ret, path.len() + 1))
405405
}
406406
}
407407

0 commit comments

Comments
 (0)