diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-27 05:31:09 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2008-07-27 05:31:09 +0000 |
commit | b551bec9bc298fbade6bfe5c009dd417c5abd95f (patch) | |
tree | 32249fa2ce87d093c56c7a3669593103d6e59dc2 /buffer.c | |
parent | Added a warning message when passwords are cached in memory. (diff) | |
download | openvpn-b551bec9bc298fbade6bfe5c009dd417c5abd95f.tar.xz |
Added additional defensive programming to buffer.[ch] functions.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@3128 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -42,6 +42,12 @@ array_mult_safe (const size_t m1, const size_t m2) return (size_t) res; } +void +buf_size_error (size_t size) +{ + msg (M_FATAL, "fatal buffer size error, size=%lu", (unsigned long)size); +} + struct buffer #ifdef DMALLOC alloc_buf_debug (size_t size, const char *file, int line) @@ -64,6 +70,8 @@ alloc_buf_gc (size_t size, struct gc_arena *gc) #endif { struct buffer buf; + if (!buf_size_valid (size)) + buf_size_error (size); buf.capacity = (int)size; buf.offset = 0; buf.len = 0; |