diff options
author | bms <bms@FreeBSD.org> | 2009-04-29 09:58:31 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2009-04-29 09:58:31 +0000 |
commit | 259233890b4d219eae5d3c18279442bf16535182 (patch) | |
tree | 11b07abe9c93d517a82ccf469309138fca61c5cb /lib | |
parent | a782d765331c976124672926309e54a979e7813e (diff) | |
download | FreeBSD-src-259233890b4d219eae5d3c18279442bf16535182.zip FreeBSD-src-259233890b4d219eae5d3c18279442bf16535182.tar.gz |
Fix an obvious bug in getsourcefilter()'s use of struct __msfilterreq;
the kernel will return in msfr_nsrcs the number of source filters
in-mode for a given multicast group.
However, the filters themselves were never copied out, as the libc
function clobbers this field with zero, causing the kernel to assume
the provided vector of struct sockaddr_storage has zero length.
This bug would only affect users of SSM multicast, which is shimmed
in 7.x.
Picked up during mtest(8) refactoring.
MFC after: 1 day
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/sourcefilter.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/net/sourcefilter.c b/lib/libc/net/sourcefilter.c index 71cc5a5..cc0f1b9 100644 --- a/lib/libc/net/sourcefilter.c +++ b/lib/libc/net/sourcefilter.c @@ -337,7 +337,7 @@ getsourcefilter(int s, uint32_t interface, struct sockaddr *group, { struct __msfilterreq msfr; sockunion_t *psu; - int err, level, optlen, optname; + int err, level, nsrcs, optlen, optname; if (interface == 0 || group == NULL || numsrc == NULL || fmode == NULL) { @@ -345,6 +345,7 @@ getsourcefilter(int s, uint32_t interface, struct sockaddr *group, return (-1); } + nsrcs = *numsrc; *numsrc = 0; *fmode = 0; @@ -382,7 +383,7 @@ getsourcefilter(int s, uint32_t interface, struct sockaddr *group, memset(&msfr, 0, optlen); msfr.msfr_ifindex = interface; msfr.msfr_fmode = 0; - msfr.msfr_nsrcs = *numsrc; + msfr.msfr_nsrcs = nsrcs; memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len); /* |