diff --git a/lib/core-net/output.c b/lib/core-net/output.c index b329f8018..845628133 100644 --- a/lib/core-net/output.c +++ b/lib/core-net/output.c @@ -196,7 +196,9 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len) lwsl_debug("%p new partial sent %d from %lu total\n", wsi, m, (unsigned long)real_len); - lws_buflist_append_segment(&wsi->buflist_out, buf + m, real_len - m); + if (lws_buflist_append_segment(&wsi->buflist_out, buf + m, + real_len - m) < 0) + return -1; lws_stats_atomic_bump(wsi->context, pt, LWSSTATS_C_WRITE_PARTIALS, 1); lws_stats_atomic_bump(wsi->context, pt, diff --git a/lib/tls/mbedtls/lws-genrsa.c b/lib/tls/mbedtls/lws-genrsa.c index 5eb6c5b75..73c40cd75 100644 --- a/lib/tls/mbedtls/lws-genrsa.c +++ b/lib/tls/mbedtls/lws-genrsa.c @@ -146,8 +146,9 @@ lws_genrsa_new_keypair(struct lws_context *context, struct lws_genrsa_ctx *ctx, if (!el[n].buf) goto cleanup; el[n].len = mbedtls_mpi_size(mpi[n]); - mbedtls_mpi_write_binary(mpi[n], el[n].buf, - el[n].len); + if (mbedtls_mpi_write_binary(mpi[n], el[n].buf, + el[n].len)) + goto cleanup; } }