From 81b481ef2fb8631210c23882ec0e3400e911bb65 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 8 Nov 2021 10:09:35 +0000 Subject: [PATCH] h2: coverity: check for OOM on dynamic table alloc It can fail, we should check it. --- lib/roles/http/server/server.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c index 150eeec56..57953cac6 100644 --- a/lib/roles/http/server/server.c +++ b/lib/roles/http/server/server.c @@ -2437,8 +2437,9 @@ upgrade_h2c: lws_h2_settings(wsi, &wsi->h2.h2n->peer_set, (uint8_t *)tbuf, n); - lws_hpack_dynamic_size(wsi, (int)wsi->h2.h2n->peer_set.s[ - H2SET_HEADER_TABLE_SIZE]); + if (lws_hpack_dynamic_size(wsi, (int)wsi->h2.h2n->peer_set.s[ + H2SET_HEADER_TABLE_SIZE])) + return 1; strcpy(tbuf, "HTTP/1.1 101 Switching Protocols\x0d\x0a" "Connection: Upgrade\x0d\x0a"