summaryrefslogtreecommitdiff
path: root/src/or/buffers.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-09-13 09:07:12 -0400
committerNick Mathewson <nickm@torproject.org>2016-09-13 09:07:12 -0400
commit20c4b0169493dae7624632dbca49758812138aeb (patch)
treeee4c6ee7fbc6f84f361415b1f34ca35a5cbbc12e /src/or/buffers.h
parent4b182dfc237ba4457b654a0dbc124f721024dab2 (diff)
downloadtor-20c4b0169493dae7624632dbca49758812138aeb.tar.gz
tor-20c4b0169493dae7624632dbca49758812138aeb.zip
Make preferred_chunk_size avoid overflow, handle big inputs better
Also, add tests for the function. Closes 20081; bugfix on 0.2.0.16-alpha. This is a Guido Vranken issue. Thanks, Guido!
Diffstat (limited to 'src/or/buffers.h')
-rw-r--r--src/or/buffers.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/or/buffers.h b/src/or/buffers.h
index 275867c70a..52b21d5885 100644
--- a/src/or/buffers.h
+++ b/src/or/buffers.h
@@ -65,6 +65,7 @@ void assert_buf_ok(buf_t *buf);
STATIC int buf_find_string_offset(const buf_t *buf, const char *s, size_t n);
STATIC void buf_pullup(buf_t *buf, size_t bytes);
void buf_get_first_chunk_data(const buf_t *buf, const char **cp, size_t *sz);
+STATIC size_t preferred_chunk_size(size_t target);
#define DEBUG_CHUNK_ALLOC
/** A single chunk on a buffer. */