summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-06-16 10:43:01 -0400
committerNick Mathewson <nickm@torproject.org>2016-06-16 10:43:01 -0400
commit79370914d1a88adde03dc514bf94fc3e6c3c030c (patch)
tree207e3f7b08986cdff2adc2b8c699cfc89c4305e6 /src/common/util.c
parent41cb26c1696b2e91f6ffe28c98ab471b925de9e8 (diff)
downloadtor-79370914d1a88adde03dc514bf94fc3e6c3c030c.tar.gz
tor-79370914d1a88adde03dc514bf94fc3e6c3c030c.zip
tests for size_mul_check__()
it's important, and we should make sure we got it right.
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index d005dade53..884d74f71b 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -206,6 +206,15 @@ size_mul_check(const size_t x, const size_t y)
x <= SIZE_MAX / y);
}
+#ifdef TOR_UNIT_TESTS
+/** Exposed for unit tests only */
+int
+size_mul_check__(const size_t x, const size_t y)
+{
+ return size_mul_check(x,y);
+}
+#endif
+
/** Allocate a chunk of <b>nmemb</b>*<b>size</b> bytes of memory, fill
* the memory with zero bytes, and return a pointer to the result.
* Log and terminate the process on error. (Same as