FreeBSD Bugzilla – Attachment 224258 Details for
Bug 255089
net/bird2: gw sdl_len too small
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Workaround for stricter sockaddr_dl checks on FBSD 13
patch-sysdep_bsd_krt-sock.c (text/plain), 1.12 KB, created by
Stefan Haller
on 2021-04-19 16:18:14 UTC
(
hide
)
Description:
Workaround for stricter sockaddr_dl checks on FBSD 13
Filename:
MIME Type:
Creator:
Stefan Haller
Created:
2021-04-19 16:18:14 UTC
Size:
1.12 KB
patch
obsolete
>--- sysdep/bsd/krt-sock.c.orig 2021-03-21 22:29:42 UTC >+++ sysdep/bsd/krt-sock.c >@@ -6,6 +6,7 @@ > * Can be freely distributed and used under the terms of the GNU GPL. > */ > >+#include <assert.h> > #include <stdio.h> > #include <stdlib.h> > #include <ctype.h> >@@ -189,7 +189,17 @@ struct ks_msg > static inline void > sockaddr_fill_dl(struct sockaddr_dl *sa, struct iface *ifa) > { >- uint len = OFFSETOF(struct sockaddr_dl, sdl_data); >+ /* The original code does not work on FreeBSD 13.0. The kernel checks >+ if the passed struct is properly initialized. It checks that len is at >+ least as large as sizeof(sockaddr_dl_short). Unfortunately, >+ sockaddr_dl_short is not defined in the user space header file. >+ >+ Also note that the caller only ever allocates `sizeof(struct sockaddr*)` >+ for the `struct sockaddr_dl*` parameter, but sockaddr_dl is potentially >+ much bigger. */ >+ // uint len = OFFSETOF(struct sockaddr_dl, sdl_data); // buggy >+ static_assert(sizeof(struct sockaddr) <= sizeof(struct sockaddr_dl)); >+ uint len = sizeof(struct sockaddr); > memset(sa, 0, len); > sa->sdl_len = len; > sa->sdl_family = AF_LINK;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 255089
: 224258