IPv6 scope IDs are unsigned
We need to make sure that a large scope ID saved in a QString does get converted properly back to an integer. Change-Id: Iee8cbc07c4434ce9b560ffff13c9bd0e9008bd9c Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
parent
bc59424ed4
commit
f5edf2b6fb
@ -100,7 +100,7 @@ static QHostAddress addressFromSockaddr(sockaddr *sa, int ifindex = 0, const QSt
|
||||
address.setScopeId(QLatin1String(scopeid));
|
||||
} else
|
||||
#endif
|
||||
address.setScopeId(QString::number(scope));
|
||||
address.setScopeId(QString::number(uint(scope)));
|
||||
}
|
||||
}
|
||||
return address;
|
||||
|
@ -134,7 +134,7 @@ static inline uint makeScopeId(const QHostAddress &addr)
|
||||
return 0;
|
||||
|
||||
bool ok;
|
||||
uint id = scopeid.toInt(&ok);
|
||||
uint id = scopeid.toUInt(&ok);
|
||||
#ifndef QT_NO_IPV6IFNAME
|
||||
if (!ok)
|
||||
id = ::if_nametoindex(scopeid.toLatin1());
|
||||
|
@ -209,7 +209,7 @@ void QNativeSocketEnginePrivate::setPortAndAddress(sockaddr_in * sockAddrIPv4, q
|
||||
|| socketProtocol == QAbstractSocket::AnyIPProtocol) {
|
||||
memset(sockAddrIPv6, 0, sizeof(qt_sockaddr_in6));
|
||||
sockAddrIPv6->sin6_family = AF_INET6;
|
||||
sockAddrIPv6->sin6_scope_id = address.scopeId().toInt();
|
||||
sockAddrIPv6->sin6_scope_id = address.scopeId().toUInt();
|
||||
WSAHtons(socketDescriptor, port, &(sockAddrIPv6->sin6_port));
|
||||
Q_IPV6ADDR tmp = address.toIPv6Address();
|
||||
memcpy(&(sockAddrIPv6->sin6_addr.qt_s6_addr), &tmp, sizeof(tmp));
|
||||
|
Loading…
Reference in New Issue
Block a user