X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fmeshlink.c;h=e50be188b32ef9b19b96c2961766da4ef2d60bc4;hp=14ff7155888c96a04ff33945dfd71dcf9e4481dd;hb=f95981a276aa0dbd03f51190949fa8c5db74d8ff;hpb=184155443a03b095155b210945a705b7f936cc4d diff --git a/src/meshlink.c b/src/meshlink.c index 14ff7155..e50be188 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -3675,6 +3675,11 @@ static void channel_poll(struct utcp_connection *connection, size_t len) { if(aio->data) { sent = utcp_send(connection, (char *)aio->data + aio->done, todo); } else { + /* Limit the amount we read at once to avoid stack overflows */ + if(todo > 65536) { + todo = 65536; + } + char buf[todo]; ssize_t result = read(aio->fd, buf, todo);