fix undefined behaviour

This commit is contained in:
Sergio R. Caprile
2025-01-16 20:42:43 -03:00
parent 8af319b953
commit 9e255bcbce
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -4725,6 +4725,7 @@ static void handle_tls_recv(struct mg_connection *c) {
size_t avail = mg_tls_pending(c);
size_t min = avail > MG_MAX_RECV_SIZE ? MG_MAX_RECV_SIZE : avail;
struct mg_iobuf *io = &c->recv;
if (avail == 0) return;
if (io->size - io->len < min && !mg_iobuf_resize(io, io->len + min)) {
mg_error(c, "oom");
} else {
+1
View File
@@ -645,6 +645,7 @@ static void handle_tls_recv(struct mg_connection *c) {
size_t avail = mg_tls_pending(c);
size_t min = avail > MG_MAX_RECV_SIZE ? MG_MAX_RECV_SIZE : avail;
struct mg_iobuf *io = &c->recv;
if (avail == 0) return;
if (io->size - io->len < min && !mg_iobuf_resize(io, io->len + min)) {
mg_error(c, "oom");
} else {