mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix possible heap corruption in CUserId()
If the size of the userId is larger than TOX_CLIENT_ID_SIZE, then we used to memcpy more than we allocated
This commit is contained in:
parent
0d251f24fd
commit
c39e0608f4
|
@ -59,7 +59,7 @@ uint16_t CData::fromString(const QString& data, uint8_t* cData)
|
||||||
const uint16_t CUserId::SIZE{TOX_CLIENT_ID_SIZE};
|
const uint16_t CUserId::SIZE{TOX_CLIENT_ID_SIZE};
|
||||||
|
|
||||||
CUserId::CUserId(const QString &userId) :
|
CUserId::CUserId(const QString &userId) :
|
||||||
CData(userId, SIZE)
|
CData(userId, SIZE < userId.size() ? userId.size() : SIZE)
|
||||||
{
|
{
|
||||||
// intentionally left empty
|
// intentionally left empty
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user