Skip to content

Missing NULL Checks for Buffer Allocations #4

@LinuxMainframe

Description

@LinuxMainframe

Critical: Missing NULL Checks for Buffer Allocations

Priority: CRITICAL

Type: Memory Safety

Location

libwsv5.c line 1772-1775 in obsws_connect()

Issue

Buffer allocations are not checked for NULL before use:

conn->recv_buffer_size = OBSWS_DEFAULT_BUFFER_SIZE;
conn->recv_buffer = malloc(conn->recv_buffer_size);  // ← NO CHECK!
conn->send_buffer_size = OBSWS_DEFAULT_BUFFER_SIZE;
conn->send_buffer = malloc(conn->send_buffer_size);  // ← NO CHECK!

Impact

If malloc fails (out of memory):

  • recv_buffer or send_buffer will be NULL
  • Later operations will dereference NULL → crash
  • No graceful error handling

Note: Should also check the lws_context and wsi allocations later in the function for consistency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CRITICALNeeds Fixing ASAP

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions