From eca2411eb67461bf3cda66d0f981b47698ab99f3 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Wed, 25 Aug 2010 14:43:49 +0200 Subject: Fill in sinfo_assoc_id in struct sctp_sndrcvinfo for getopt() The assoc_id field was uninitialized causing random answers. --- erts/emulator/drivers/common/inet_drv.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'erts/emulator/drivers') diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 059288d1cb..10cd140cf4 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -6193,6 +6193,10 @@ static int sctp_fill_opts(inet_descriptor* desc, char* buf, int buflen, struct sctp_sndrcvinfo sri; unsigned int sz = sizeof(sri); + if (buflen < ASSOC_ID_LEN) RETURN_ERROR(spec, -EINVAL); + sri.sinfo_assoc_id = GET_ASSOC_ID(buf); + buf += ASSOC_ID_LEN; + buflen -= ASSOC_ID_LEN; if (sock_getopt(desc->s, IPPROTO_SCTP, SCTP_DEFAULT_SEND_PARAM, &sri, &sz) < 0) continue; /* Fill in the response: */ -- cgit v1.2.3