summaryrefslogtreecommitdiffstats
path: root/buffer.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-09-17 23:43:37 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-09-17 23:43:37 +0000
commit673f583f76358b57e7f610084d3cb28bb2a9c4a2 (patch)
tree6d9c8bdd75055e42049937f69bdbcf9368eaab89 /buffer.c
parent72bf37c7130719ce105d73600341379389c4031f (diff)
downloadopenvpn-673f583f76358b57e7f610084d3cb28bb2a9c4a2.tar.gz
openvpn-673f583f76358b57e7f610084d3cb28bb2a9c4a2.tar.xz
openvpn-673f583f76358b57e7f610084d3cb28bb2a9c4a2.zip
The maximum number of "route" directives (specified in the config
file or pulled from a server) can now be configured via the new "max-routes" directive. Previously, the limit was set to 100 and fixed by a compile-time constant. Now the limit is dynamic and can be modified by the "max-routes" directive. If max-routes is not specified, the default limit is 100. Note that this change does not address the maximum size of the pushed options string sent from server to client, which is still controlled by the TLS_CHANNEL_BUF_SIZE compile-time constant. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@4967 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/buffer.c b/buffer.c
index 15ab776..d448e5d 100644
--- a/buffer.c
+++ b/buffer.c
@@ -33,11 +33,11 @@
#include "memdbg.h"
size_t
-array_mult_safe (const size_t m1, const size_t m2)
+array_mult_safe (const size_t m1, const size_t m2, const size_t extra)
{
const size_t limit = 0xFFFFFFFF;
- unsigned long long res = (unsigned long long)m1 * (unsigned long long)m2;
- if (unlikely(m1 > limit) || unlikely(m2 > limit) || unlikely(res > (unsigned long long)limit))
+ unsigned long long res = (unsigned long long)m1 * (unsigned long long)m2 + (unsigned long long)extra;
+ if (unlikely(m1 > limit) || unlikely(m2 > limit) || unlikely(extra > limit) || unlikely(res > (unsigned long long)limit))
msg (M_FATAL, "attemped allocation of excessively large array");
return (size_t) res;
}