summaryrefslogtreecommitdiff
path: root/present
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2018-03-19 16:04:43 +0000
committerAdam Jackson <ajax@redhat.com>2018-03-19 15:46:41 -0400
commit6a5d51e0823b43280e3646b7a0c919a3b76146ea (patch)
tree190fa89c6dcbf6d22a0c5de25ee7ac2ad6735671 /present
parentabb9b58d1af9a0286162e52ef9db390d0c950fc1 (diff)
present: cap the version returned to the client
As per the protocol, the server should not return version greater than the one supported by the client. Add a spec quote and tweak the numbers accordingly. Fixes: 5c5c1b77982 ("present: Add Present extension") Cc: Thierry Reding <treding@nvidia.com> Cc: Daniel Stone <daniels@collabora.com> Cc: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'present')
-rw-r--r--present/present_request.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/present/present_request.c b/present/present_request.c
index c6afe5fa7..f52efa52b 100644
--- a/present/present_request.c
+++ b/present/present_request.c
@@ -41,7 +41,19 @@ proc_present_query_version(ClientPtr client)
};
REQUEST_SIZE_MATCH(xPresentQueryVersionReq);
- (void) stuff;
+ /* From presentproto:
+ *
+ * The client sends the highest supported version to the server
+ * and the server sends the highest version it supports, but no
+ * higher than the requested version.
+ */
+
+ if (rep.majorVersion > stuff->majorVersion ||
+ rep.minorVersion > stuff->minorVersion) {
+ rep.majorVersion = stuff->majorVersion;
+ rep.minorVersion = stuff->minorVersion;
+ }
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);