Commit 0610c0fd authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Fix creation of invalid negative transport ids by cast uint32 -> int

Port of KRandom::random to QRandomGenerator in
b5572156 missed that generate() uses all
bits of the uint32, and the compiler does not warn when casting uint to int

Current code assumes only positive ids to be valid, so some checks will
assume the transport is not correctly configured.

Also set 1 as lowest minimal value, as a 0 value will be discarded anyway.
parent ce42a12d
Pipeline #73880 canceled with stage
......@@ -527,7 +527,7 @@ int TransportManagerPrivate::createId() const
usedIds << 0; // 0 is default for unknown
int newId;
do {
newId = QRandomGenerator::global()->generate();
newId = QRandomGenerator::global()->bounded(1, RAND_MAX);
} while (usedIds.contains(newId));
return newId;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment