diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index dd5ace348..faf401634 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -313,6 +313,8 @@ SELinuxPopulateItem(SELinuxListItemRec * i, PrivateRec ** privPtr, CARD32 id, SELinuxObjectRec *obj = dixLookupPrivate(privPtr, objectKey); SELinuxObjectRec *data = dixLookupPrivate(privPtr, dataKey); + if (!i) + return BadValue; if (avc_sid_to_context_raw(obj->sid, &i->octx) < 0) return BadValue; if (avc_sid_to_context_raw(data->sid, &i->dctx) < 0) @@ -331,6 +333,9 @@ SELinuxFreeItems(SELinuxListItemRec * items, int count) { int k; + if (!items) + return; + for (k = 0; k < count; k++) { freecon(items[k].octx); freecon(items[k].dctx); @@ -348,6 +353,9 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items, goto out; } + if (!buf) // silence analyzer warning + goto sendreply; + /* Fill in the buffer */ for (k = 0; k < count; k++) { buf[pos] = items[k].id; @@ -371,6 +379,7 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items, pos += items[k].dctx_len; } +sendreply: ; /* Send reply to client */ SELinuxListItemsReply rep = { .type = X_Reply,