Add some bounds checking to _reply functions

This is a step towards fixing a security vulnerability.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
Demi Marie Obenour 2021-09-23 16:46:27 -04:00
parent 06be1d845f
commit f96f84ee45

View File

@ -2571,6 +2571,8 @@ def _c_reply(self, name):
# certain variable size fields need to be unserialized explicitly
_c(' %s *reply = (%s *) xcb_wait_for_reply_safe(c, cookie.sequence, e, sizeof (*reply));',
self.c_reply_type, self.c_reply_type)
_c(' if (!reply)')
_c(' return NULL;')
_c(' int i;')
for field in unserialize_fields: