Skip to content

Commit

Permalink
fix undefined behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
scaprile committed Jan 16, 2025
1 parent 8af319b commit 9e255bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/net_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9e255bc

Please sign in to comment.