diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-05 09:29:04 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-05 16:09:09 +1000 |
commit | c77f42049f77417c68bbce3dd2e995d916fc5af5 (patch) | |
tree | 0f8e782db813780f34ae74fcebec101d27c28ec8 /Xi | |
parent | b6c16fc7dad5a4ffcaaab647c0e3fabed372efd5 (diff) |
Xi: fix flawed logic in XIQueryVersion return value.
The server returned the minimum of major/minor each instead of the lower of
the combined major.minor version. As a result, a client reporting
3.0 and a server supporting 2.7, the return value would be 2.0 (the minimum
of both).
Reported-by: RĂ©mi Cardona
Reported-by: Simon Thum
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/queryversion.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Xi/queryversion.c b/Xi/queryversion.c index 385c9658d..230e20771 100644 --- a/Xi/queryversion.c +++ b/Xi/queryversion.c @@ -58,6 +58,7 @@ ProcXIQueryVersion(ClientPtr client) xXIQueryVersionReply rep; XIClientPtr pXIClient; int major, minor; + unsigned int sversion, cversion; REQUEST(xXIQueryVersionReq); REQUEST_SIZE_MATCH(xXIQueryVersionReq); @@ -71,8 +72,18 @@ ProcXIQueryVersion(ClientPtr client) pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey); - major = min(XIVersion.major_version, stuff->major_version); - minor = min(XIVersion.minor_version, stuff->minor_version); + sversion = XIVersion.major_version * 1000 + XIVersion.minor_version; + cversion = stuff->major_version * 1000 + stuff->minor_version; + + if (sversion > cversion) + { + major = stuff->major_version; + minor = stuff->minor_version; + } else + { + major = XIVersion.major_version; + minor = XIVersion.minor_version; + } pXIClient->major_version = major; pXIClient->minor_version = minor; |