1
0
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:
Tux3 / Mlkj / !Lev.uXFMLA 2014-11-02 23:39:28 +01:00
parent 0d251f24fd
commit c39e0608f4
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -59,7 +59,7 @@ uint16_t CData::fromString(const QString& data, uint8_t* cData)
const uint16_t CUserId::SIZE{TOX_CLIENT_ID_SIZE};
CUserId::CUserId(const QString &userId) :
CData(userId, SIZE)
CData(userId, SIZE < userId.size() ? userId.size() : SIZE)
{
// intentionally left empty
}