diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-07-21 10:05:36 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-07-21 10:11:02 -0700 |
commit | 4e4eb10495cc0d24b02c4cc82d86f3977f3cc95f (patch) | |
tree | c30263b454d0fe1edc99e4581c569be0803b46f1 /src | |
parent | 3f05df5a6c5140dc3d44f35b9fb635cca8b682c1 (diff) |
parse_reply_call_callback: avoid NULL dereference if reply is missing data
Clears up 7 -Wanalyzer-null-dereference warnings from gcc 14.1
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxtst/-/merge_requests/7>
Diffstat (limited to 'src')
-rw-r--r-- | src/XRecord.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/XRecord.c b/src/XRecord.c index 11d23f6..32c17bb 100644 --- a/src/XRecord.c +++ b/src/XRecord.c @@ -745,6 +745,8 @@ parse_reply_call_callback( */ switch (rep->category) { case XRecordFromServer: + if (reply == NULL) + goto out; if (rep->elementHeader&XRecordFromServerTime) { if (current_index + 4 > rep->length << 2) return Error; @@ -770,6 +772,8 @@ parse_reply_call_callback( } break; case XRecordFromClient: + if (reply == NULL) + goto out; if (rep->elementHeader&XRecordFromClientTime) { if (current_index + 4 > rep->length << 2) goto out; @@ -804,6 +808,8 @@ parse_reply_call_callback( datum_bytes <<= 2; break; case XRecordClientStarted: + if (reply == NULL) + goto out; if (current_index + 8 > rep->length << 2) goto out; EXTRACT_CARD16(rep->clientSwapped, @@ -812,6 +818,8 @@ parse_reply_call_callback( break; case XRecordClientDied: if (rep->elementHeader&XRecordFromClientSequence) { + if (reply == NULL) + goto out; if (current_index + 4 > rep->length << 2) goto out; EXTRACT_CARD32(rep->clientSwapped, |