[Xcb] Is SendRequest missing some padding?

Alessandro Arzilli alessandro.arzilli at gmail.com
Thu Sep 18 05:29:03 PDT 2014


Hello,
X.org X11 protocol documentation specifies that the fields 
AuthorizationProtocolName and AuthorizationProtocolData should be padded 
(http://www.x.org/releases/current/doc/xproto/x11protocol.html#Encoding::Connection_Setup), 
xproto.xml however doesn't mention this padding anywhere.

For context, I found this out because of this: 
https://github.com/BurntSushi/xgb/issues/24
I also ran a capture with wireshark and plugged the SetupRequest packet 
in this program (https://gist.github.com/aarzilli/fcd2a0094f89c29256a9) 
and it seems that xcb also isn't decoding the padding correctly (but 
maybe I'm doing it wrong?).

Also, just adding <pad align="4" /> after the two fields didn't work for 
me, I just got a compile error with libxcb-1.11.
This, much uglier, change did work:
---
--- xproto.xml.old	2014-09-18 13:34:17.794910423 +0200
+++ xproto.xml	2014-09-18 13:54:38.946273390 +0200
@@ -193,10 +193,28 @@
      <field type="CARD16" name="authorization_protocol_data_len" />
      <pad bytes="2" />
      <list type="char" name="authorization_protocol_name">
-      <fieldref>authorization_protocol_name_len</fieldref>
+      <op op="*">
+        <op op="/">
+          <op op="+">
+            <fieldref>authorization_protocol_name_len</fieldref>
+            <value>3</value>
+          </op>
+          <value>4</value>
+        </op>
+        <value>4</value>
+      </op>
      </list>
      <list type="char" name="authorization_protocol_data">
-      <fieldref>authorization_protocol_data_len</fieldref>
+      <op op="*">
+        <op op="/">
+          <op op="+">
+            <fieldref>authorization_protocol_data_len</fieldref>
+            <value>3</value>
+          </op>
+          <value>4</value>
+        </op>
+        <value>4</value>
+      </op>
      </list>
    </struct>
---

Thank you,
Alessandro Arzilli


More information about the Xcb mailing list