buffer: fix padding distances

This commit is contained in:
Greg Farnum 2010-06-07 14:57:47 -07:00
parent c196851bd7
commit 76fb75e988

View File

@ -28,7 +28,7 @@ atomic_t buffer_total_alloc;
void buffer::list::encode_base64(buffer::list& o)
{
bufferptr bp(length() * 4 / 3 + 1);
bufferptr bp(length() * 4 / 3 + 3);
int l = ceph_armor(bp.c_str(), c_str(), c_str() + length());
bp.set_length(l);
o.push_back(bp);
@ -36,7 +36,7 @@ void buffer::list::encode_base64(buffer::list& o)
void buffer::list::decode_base64(buffer::list& e)
{
bufferptr bp(e.length() * 3 / 4 + 1);
bufferptr bp(e.length() * 3 / 4 + 4);
int l = ceph_unarmor(bp.c_str(), e.c_str(), e.c_str() + e.length());
assert(l <= (int)bp.length());
bp.set_length(l);