Skip to content

Commit 38db37d

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 (apply <#4062> to `main`) (cherry picked from commit d63be8b)
1 parent 569d52c commit 38db37d

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

+7-2
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ s! {
11531153
pub sinfo_assoc_id: ::sctp_assoc_t,
11541154
pub sinfo_keynumber: u16,
11551155
pub sinfo_keynumber_valid: u16,
1156-
pub __reserve_pad: [[u8; 23]; 4],
1156+
pub __reserve_pad: [u8; SCTP_ALIGN_RESV_PAD],
11571157
}
11581158

11591159
pub struct sctp_extrcvinfo {
@@ -1173,7 +1173,7 @@ s! {
11731173
pub serinfo_next_ppid: u32,
11741174
pub sinfo_keynumber: u16,
11751175
pub sinfo_keynumber_valid: u16,
1176-
pub __reserve_pad: [[u8; 19]; 4],
1176+
pub __reserve_pad: [u8; SCTP_ALIGN_RESV_PAD_SHORT],
11771177
}
11781178

11791179
pub struct sctp_sndinfo {
@@ -4881,6 +4881,11 @@ pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008;
48814881
pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004;
48824882
pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008;
48834883

4884+
// sctp_uio.h
4885+
4886+
pub const SCTP_ALIGN_RESV_PAD: usize = 92;
4887+
pub const SCTP_ALIGN_RESV_PAD_SHORT: usize = 76;
4888+
48844889
pub const KENV_DUMP_LOADER: ::c_int = 4;
48854890
pub const KENV_DUMP_STATIC: ::c_int = 5;
48864891

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

+1-1
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)