dix: resource: protect FakeClientID() from returning 0
Some callers treating XID = 0 as a sign for non-existing resource. Practically should not happen, but nevertheless adding extra protection, just in case. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
eb95982b2a
commit
030b441e21
|
@ -789,6 +789,12 @@ FakeClientID(int client)
|
||||||
XID id, maxid;
|
XID id, maxid;
|
||||||
|
|
||||||
id = clientTable[client].fakeID++;
|
id = clientTable[client].fakeID++;
|
||||||
|
|
||||||
|
// extra paranoid protection, because many places expect 0 as
|
||||||
|
// sign for resource not existing
|
||||||
|
if (!id)
|
||||||
|
return FakeClientID(client);
|
||||||
|
|
||||||
if (id != clientTable[client].endFakeID)
|
if (id != clientTable[client].endFakeID)
|
||||||
return id;
|
return id;
|
||||||
GetXIDRange(client, TRUE, &id, &maxid);
|
GetXIDRange(client, TRUE, &id, &maxid);
|
||||||
|
@ -801,6 +807,10 @@ FakeClientID(int client)
|
||||||
}
|
}
|
||||||
clientTable[client].fakeID = id + 1;
|
clientTable[client].fakeID = id + 1;
|
||||||
clientTable[client].endFakeID = maxid + 1;
|
clientTable[client].endFakeID = maxid + 1;
|
||||||
|
|
||||||
|
if (!id)
|
||||||
|
return FakeClientID(client);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue