mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
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)
|
||||
{
|
||||
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 &&
|
||||
type != SOCK_DGRAM) {
|
||||
return 0;
|
||||
@ -494,13 +495,13 @@ int EmbedReceiveFrom(WOLFSSL *ssl, char *buf, int sz, void *ctx)
|
||||
}
|
||||
else if (dtlsCtx->userSet) {
|
||||
/* Truncate peer size */
|
||||
if (peerSz > sizeof(lclPeer))
|
||||
peerSz = sizeof(lclPeer);
|
||||
if (peerSz > (XSOCKLENT)sizeof(lclPeer))
|
||||
peerSz = (XSOCKLENT)sizeof(lclPeer);
|
||||
}
|
||||
else {
|
||||
/* Truncate peer size */
|
||||
if (peerSz > dtlsCtx->peer.bufSz)
|
||||
peerSz = dtlsCtx->peer.bufSz;
|
||||
if (peerSz > (XSOCKLENT)dtlsCtx->peer.bufSz)
|
||||
peerSz = (XSOCKLENT)dtlsCtx->peer.bufSz;
|
||||
}
|
||||
|
||||
recvd = TranslateReturnCode(recvd, sd);
|
||||
|
Reference in New Issue
Block a user