From f96f84ee45a1da617c218c0d34ac43c3f7041da9 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Thu, 23 Sep 2021 16:46:27 -0400 Subject: [PATCH] Add some bounds checking to _reply functions This is a step towards fixing a security vulnerability. Signed-off-by: Demi Marie Obenour --- src/c_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/c_client.py b/src/c_client.py index df31466..78de77a 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -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: