Skip to content

Commit d63be8b

Browse files
committed
Fix a few other array size hacks
Sources: * FreeBSD `__reserve_pad`: [1] * NetBSD `accept_filter_arg`: https://man.netbsd.org/setsockopt.2 [1]: https://github.com/freebsd/freebsd-src/blob/4b4e88d9425b59a377a71ffeb553376b1c60a80e/sys/netinet/sctp_uio.h#L110-L146
1 parent 27ee6fe commit d63be8b

File tree

2 files changed

+8
-3
lines changed
  • src/unix/bsd

2 files changed

+8
-3
lines changed

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ s! {
11451145
pub sinfo_assoc_id: ::sctp_assoc_t,
11461146
pub sinfo_keynumber: u16,
11471147
pub sinfo_keynumber_valid: u16,
1148-
pub __reserve_pad: [[u8; 23]; 4],
1148+
pub __reserve_pad: [u8; SCTP_ALIGN_RESV_PAD],
11491149
}
11501150

11511151
pub struct sctp_extrcvinfo {
@@ -1165,7 +1165,7 @@ s! {
11651165
pub serinfo_next_ppid: u32,
11661166
pub sinfo_keynumber: u16,
11671167
pub sinfo_keynumber_valid: u16,
1168-
pub __reserve_pad: [[u8; 19]; 4],
1168+
pub __reserve_pad: [u8; SCTP_ALIGN_RESV_PAD_SHORT],
11691169
}
11701170

11711171
pub struct sctp_sndinfo {
@@ -4874,6 +4874,11 @@ pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008;
48744874
pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004;
48754875
pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008;
48764876

4877+
// sctp_uio.h
4878+
4879+
pub const SCTP_ALIGN_RESV_PAD: usize = 92;
4880+
pub const SCTP_ALIGN_RESV_PAD_SHORT: usize = 76;
4881+
48774882
pub const KENV_DUMP_LOADER: ::c_int = 4;
48784883
pub const KENV_DUMP_STATIC: ::c_int = 5;
48794884

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ s! {
512512

513513
pub struct accept_filter_arg {
514514
pub af_name: [::c_char; 16],
515-
af_arg: [[::c_char; 10]; 24],
515+
pub af_arg: [::c_char; 256 - 16],
516516
}
517517

518518
pub struct ki_sigset_t {

0 commit comments

Comments
 (0)