diff --git a/lib/core/output.c b/lib/core/output.c index 8f6349bc1569d4dff5b611febfd3bb46a3f15ef9..af9a53cfd20279ed0f3d1f67ca0000e25d5e7e00 100644 --- a/lib/core/output.c +++ b/lib/core/output.c @@ -84,7 +84,7 @@ int lws_issue_raw(struct lws *wsi, unsigned char *buf, size_t len) lwsl_debug("%s: draining %d\n", __func__, (int)len); } - if (!len) + if (!len || !buf) return 0; if (!wsi->http2_substream && !lws_socket_is_valid(wsi->desc.sockfd)) diff --git a/lib/roles/h2/ops-h2.c b/lib/roles/h2/ops-h2.c index 636e8f9b94ba0e9d98501dab2fb3ea983070550e..c92dd463493dec6ca337ec25e5be6255084af8dd 100644 --- a/lib/roles/h2/ops-h2.c +++ b/lib/roles/h2/ops-h2.c @@ -362,6 +362,9 @@ rops_write_role_protocol_h2(struct lws *wsi, unsigned char *buf, size_t len, unsigned char flags = 0, base = (*wp) & 0x1f; size_t olen = len; int n; +#if defined(LWS_WITH_HTTP_STREAM_COMPRESSION) + unsigned char mtubuf[1450 + LWS_PRE]; +#endif /* if not in a state to send stuff, then just send nothing */ @@ -386,7 +389,7 @@ rops_write_role_protocol_h2(struct lws *wsi, unsigned char *buf, size_t len, #if defined(LWS_WITH_HTTP_STREAM_COMPRESSION) if (wsi->http.lcs) { - unsigned char mtubuf[1450 + LWS_PRE], *out = mtubuf + LWS_PRE; + unsigned char *out = mtubuf + LWS_PRE; size_t o = sizeof(mtubuf) - LWS_PRE; n = lws_http_compression_transform(wsi, buf, len, wp, &out, &o); diff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c index e1e1bd9732b0ec8d1b7d54f17195ad31f8714f15..25751964baf3b96dd31c5c8e4f8259f79ae97c23 100644 --- a/lib/roles/http/server/server.c +++ b/lib/roles/http/server/server.c @@ -587,7 +587,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin, /* but we still need to send cache control... */ - if (m && m->cache_max_age && m->cache_reusable) { + if (m->cache_max_age && m->cache_reusable) { if (!m->cache_revalidate) { cc = cache_control; cclen = sprintf(cache_control, "%s, max-age=%u",