diff options
author | Christian Pointner <equinox@anytun.org> | 2008-03-03 17:59:57 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2008-03-03 17:59:57 +0000 |
commit | 30dbbc65bd3684b9cefa000069b611a608f4be3e (patch) | |
tree | 68614a0ccd2a68c3fcd90b5a7652f798f795d50e /buffer.cpp | |
parent | added showtable (diff) |
some bugfixes
added support for authentication
Diffstat (limited to 'buffer.cpp')
-rw-r--r-- | buffer.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -56,6 +56,12 @@ Buffer::Buffer(u_int32_t length, bool allow_realloc) : length_(length), real_len Buffer::Buffer(u_int8_t* data, u_int32_t length, bool allow_realloc) : length_(length), real_length_(length + Buffer::OVER_SIZE_), allow_realloc_(allow_realloc) { + if(!data) { + length_ = 0; + real_length_ = 0; + return; + } + buf_ = new u_int8_t[real_length_]; if(!buf_) { length_ = 0; @@ -182,11 +188,11 @@ void Buffer::setLength(u_int32_t new_length) old_buf = &buf_[old_length]; std::memset(old_buf, 0, real_length_ - old_length); - - reinit(); } else length_ = new_length; + + reinit(); } |