forked from wolfSSL/wolfssl
Merge pull request #5540 from dgarske/socksz
Fixes for building with 32-bit and socket size sign/unsigned mismatch
This commit is contained in:
13
src/wolfio.c
13
src/wolfio.c
@ -375,8 +375,9 @@ static int sockAddrEqual(
|
|||||||
static int isDGramSock(int sfd)
|
static int isDGramSock(int sfd)
|
||||||
{
|
{
|
||||||
int type = 0;
|
int type = 0;
|
||||||
XSOCKLENT length = sizeof(int); /* optvalue 'type' is of size int */
|
/* optvalue 'type' is of size int */
|
||||||
|
XSOCKLENT length = (XSOCKLENT)sizeof(int);
|
||||||
|
|
||||||
if (getsockopt(sfd, SOL_SOCKET, SO_TYPE, &type, &length) == 0 &&
|
if (getsockopt(sfd, SOL_SOCKET, SO_TYPE, &type, &length) == 0 &&
|
||||||
type != SOCK_DGRAM) {
|
type != SOCK_DGRAM) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -494,13 +495,13 @@ int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx)
|
|||||||
}
|
}
|
||||||
else if (dtlsCtx->userSet) {
|
else if (dtlsCtx->userSet) {
|
||||||
/* Truncate peer size */
|
/* Truncate peer size */
|
||||||
if (peerSz > sizeof(lclPeer))
|
if (peerSz > (XSOCKLENT)sizeof(lclPeer))
|
||||||
peerSz = sizeof(lclPeer);
|
peerSz = (XSOCKLENT)sizeof(lclPeer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Truncate peer size */
|
/* Truncate peer size */
|
||||||
if (peerSz > dtlsCtx->peer.bufSz)
|
if (peerSz > (XSOCKLENT)dtlsCtx->peer.bufSz)
|
||||||
peerSz = dtlsCtx->peer.bufSz;
|
peerSz = (XSOCKLENT)dtlsCtx->peer.bufSz;
|
||||||
}
|
}
|
||||||
|
|
||||||
recvd = TranslateReturnCode(recvd, sd);
|
recvd = TranslateReturnCode(recvd, sd);
|
||||||
|
Reference in New Issue
Block a user