fix UB and possible HF trigger

This commit is contained in:
Sergio R. Caprile committed 2025-01-28 10:24:59 -03:00
1 parent 7d53c21efe
commit a0d9b6a7e0
3 files changed
+4 -2

No files matched your search

+1 -1
View File
@@ -651,7 +651,7 @@ static void handle_tls_recv(struct mg_connection *c) {
mg_error(c, "oom");
} else {
// Decrypt data directly into c->recv
long n = mg_tls_recv(c, &io->buf[io->len], io->size - io->len);
long n = mg_tls_recv(c, io->buf != NULL ? &io->buf[io->len] : io->buf, io->size - io->len);
if (n == MG_IO_ERR) {
mg_error(c, "TLS recv error");
} else if (n > 0) {