From 30dbbc65bd3684b9cefa000069b611a608f4be3e Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 3 Mar 2008 17:59:57 +0000 Subject: some bugfixes added support for authentication --- buffer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'buffer.cpp') diff --git a/buffer.cpp b/buffer.cpp index 675383b..250a806 100644 --- a/buffer.cpp +++ b/buffer.cpp @@ -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(); } -- cgit v1.2.3