commit b4400e2093f68e349464eacd7dbe44cebf8d5c71 Merge: 0c8c295963 69d7752937 Author: Nick Mathewson nickm@torproject.org Date: Thu Jul 30 14:28:11 2020 -0400
Merge branch 'bug40076_043' into bug40076_044
changes/bug40076 | 5 ++++ src/lib/buf/buffers.c | 2 ++ src/test/test_buffers.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+)
diff --cc src/lib/buf/buffers.c index 95b384bf06,d7b73e3807..a5031a47a6 --- a/src/lib/buf/buffers.c +++ b/src/lib/buf/buffers.c @@@ -692,9 -692,11 +692,11 @@@ buf_move_all(buf_t *buf_out, buf_t *buf tor_assert(buf_out); if (!buf_in) return; + if (buf_datalen(buf_in) == 0) + return; - if (BUG(buf_out->datalen >= INT_MAX || buf_in->datalen >= INT_MAX)) + if (BUG(buf_out->datalen > BUF_MAX_LEN || buf_in->datalen > BUF_MAX_LEN)) return; - if (BUG(buf_out->datalen >= INT_MAX - buf_in->datalen)) + if (BUG(buf_out->datalen > BUF_MAX_LEN - buf_in->datalen)) return;
if (buf_out->head == NULL) {