diff options
author | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2022-11-26 14:55:07 -0800 |
---|---|---|
committer | Jeremy Huddleston Sequoia <jeremyhu@apple.com> | 2022-11-26 22:48:00 -0800 |
commit | cb8c70f5a65b4bd68b449dcaa637c3c4753e2f81 (patch) | |
tree | 66391614fa2019aed8fce3ee2412b5814e35cc51 | |
parent | 33f3dbe3699a92e8ca18f470adac456e0b935e75 (diff) |
xcb_conn: Add a check for NULL to silence a UBSan runtime error
xcb_conn.c:314:60: runtime error: applying zero offset to null pointer
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-rw-r--r-- | src/xcb_conn.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/xcb_conn.c b/src/xcb_conn.c index 3084c18..8f91f43 100644 --- a/src/xcb_conn.c +++ b/src/xcb_conn.c @@ -310,9 +310,11 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count) int cur = (*vector)->iov_len; if(cur > n) cur = n; - (*vector)->iov_len -= cur; - (*vector)->iov_base = (char *) (*vector)->iov_base + cur; - n -= cur; + if(cur) { + (*vector)->iov_len -= cur; + (*vector)->iov_base = (char *) (*vector)->iov_base + cur; + n -= cur; + } if((*vector)->iov_len) break; } |