secureudpclient - a speculative fix for non-reproducible crash
Not much information in a bug report: QByteArray is protected from negative sizes and QUdpSocket too. FWIW - add one more check, similar to what the server counterpart already had. Pick-to: 5.15 6.0 Fixes: QTBUG-83457 Change-Id: I585fa90e0a258d2257e4fed2f24c52b47548bcbb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
188768072f
commit
b283ce1e83
@ -112,6 +112,11 @@ void DtlsAssociation::udpSocketConnected()
|
|||||||
|
|
||||||
void DtlsAssociation::readyRead()
|
void DtlsAssociation::readyRead()
|
||||||
{
|
{
|
||||||
|
if (socket.pendingDatagramSize() <= 0) {
|
||||||
|
emit warningMessage(tr("%1: spurious read notification?").arg(name));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//! [6]
|
//! [6]
|
||||||
QByteArray dgram(socket.pendingDatagramSize(), Qt::Uninitialized);
|
QByteArray dgram(socket.pendingDatagramSize(), Qt::Uninitialized);
|
||||||
const qint64 bytesRead = socket.readDatagram(dgram.data(), dgram.size());
|
const qint64 bytesRead = socket.readDatagram(dgram.data(), dgram.size());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user