mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
* ext/socket/ancdata.c (bsock_recvmsg_internal): prevent misalignment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
34152d654a
commit
f1a39b9e5c
2 changed files with 11 additions and 3 deletions
|
@ -1117,7 +1117,11 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
struct cmsghdr *cmh;
|
||||
size_t maxctllen;
|
||||
char ctlbuf0[4096], *ctlbuf;
|
||||
union {
|
||||
char bytes[4096];
|
||||
struct cmsghdr align;
|
||||
} ctlbuf0;
|
||||
char *ctlbuf;
|
||||
VALUE ctl_str = Qnil;
|
||||
#endif
|
||||
|
||||
|
@ -1170,7 +1174,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
|
||||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
if (maxctllen <= sizeof(ctlbuf0))
|
||||
ctlbuf = ctlbuf0;
|
||||
ctlbuf = ctlbuf0.bytes;
|
||||
else {
|
||||
if (NIL_P(ctl_str))
|
||||
ctl_str = rb_str_tmp_new(maxctllen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue