mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
security: add missing NULL checks after message_alloc in reply
Both reply_new and reply_error passed the message_alloc result directly to message_put without checking for NULL, which would cause a NULL pointer dereference on allocation failure. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
1b8962d7c2
commit
7c2d8f7251
1 changed files with 5 additions and 0 deletions
|
|
@ -17,6 +17,8 @@
|
|||
struct message *reply_new(const struct client *client, uint32_t tag)
|
||||
{
|
||||
struct message *reply = message_alloc(client->impl, -1, 0);
|
||||
if (reply == NULL)
|
||||
return NULL;
|
||||
|
||||
pw_log_debug("client %p: new reply tag:%u", client, tag);
|
||||
|
||||
|
|
@ -55,6 +57,9 @@ int reply_error(struct client *client, uint32_t command, uint32_t tag, int res)
|
|||
client, client->name, command, name, tag, error, spa_strerror(res));
|
||||
|
||||
reply = message_alloc(impl, -1, 0);
|
||||
if (reply == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
message_put(reply,
|
||||
TAG_U32, COMMAND_ERROR,
|
||||
TAG_U32, tag,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue