Skip to content

Commit

Permalink
buflist: append: treat NULL additional buf as error not assert
Browse files Browse the repository at this point in the history
Very very occasionally on server we try to add a NULL buffer to a buflist.

Let's try dealing with that by failing (caller must always be able to
handle failure from OOM) rather than asserting.
  • Loading branch information
lws-team committed Nov 11, 2023
1 parent bfce9f8 commit 288f36f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/core/buflist.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ lws_buflist_append_segment(struct lws_buflist **head, const uint8_t *buf,
void *p = *head;
int sanity = 1024;

assert(buf);
if (!buf)
return -1;

assert(len);

/* append at the tail */
Expand Down

0 comments on commit 288f36f

Please sign in to comment.