if (BIO_dgram_should_retry(ret)) {
BIO_set_retry_write(b);
data->_errno = get_last_socket_error();
-
-# if 0 /* higher layers are responsible for querying
- * MTU, if necessary */
- if (data->_errno == EMSGSIZE)
- /* retrieve the new MTU */
- BIO_ctrl(b, BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL);
-# endif
}
}
return (ret);
break;
case BIO_CTRL_DGRAM_CONNECT:
to = (struct sockaddr *)ptr;
-# if 0
- if (connect(b->num, to, sizeof(struct sockaddr)) < 0) {
- perror("connect");
- ret = 0;
- } else {
-# endif
- switch (to->sa_family) {
- case AF_INET:
- memcpy(&data->peer, to, sizeof(data->peer.sa_in));
- break;
+ switch (to->sa_family) {
+ case AF_INET:
+ memcpy(&data->peer, to, sizeof(data->peer.sa_in));
+ break;
# if OPENSSL_USE_IPV6
- case AF_INET6:
- memcpy(&data->peer, to, sizeof(data->peer.sa_in6));
- break;
+ case AF_INET6:
+ memcpy(&data->peer, to, sizeof(data->peer.sa_in6));
+ break;
# endif
- default:
- memcpy(&data->peer, to, sizeof(data->peer.sa));
- break;
- }
-# if 0
+ default:
+ memcpy(&data->peer, to, sizeof(data->peer.sa));
+ break;
}
-# endif
break;
/* (Linux)kernel sets DF bit on outgoing IP packets */
case BIO_CTRL_DGRAM_MTU_DISCOVER:
break;
case BIO_CTRL_DGRAM_GET_MTU:
return data->mtu;
- break;
case BIO_CTRL_DGRAM_SET_MTU:
data->mtu = num;
ret = num;
*/
sockopt_len = (socklen_t) (sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
authchunks = OPENSSL_malloc(sockopt_len);
+ if(!authchunks) {
+ BIO_vfree(bio);
+ return (NULL);
+ }
memset(authchunks, 0, sockopt_len);
ret =
getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks,
optlen =
(socklen_t) (sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
authchunks = OPENSSL_malloc(optlen);
+ if (!authchunks) {
+ BIOerr(BIO_F_DGRAM_SCTP_READ, ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
memset(authchunks, 0, optlen);
ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS,
authchunks, &optlen);
* yet, we have to save it and send it as soon as the socket gets dry.
*/
if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) {
+ char *tmp;
data->saved_message.bio = b;
+ if(!(tmp = OPENSSL_malloc(inl))) {
+ BIOerr(BIO_F_DGRAM_SCTP_WRITE, ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
if (data->saved_message.data)
OPENSSL_free(data->saved_message.data);
- data->saved_message.data = OPENSSL_malloc(inl);
+ data->saved_message.data = tmp;
memcpy(data->saved_message.data, in, inl);
data->saved_message.length = inl;
return inl;
# if defined(WSAEWOULDBLOCK)
case WSAEWOULDBLOCK:
# endif
-
-# if 0 /* This appears to always be an error */
-# if defined(WSAENOTCONN)
- case WSAENOTCONN:
-# endif
-# endif
# endif
# ifdef EWOULDBLOCK