Skip to content

Commit

Permalink
libcore|Block: Fixed initialization (missing null-termination)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent de95716 commit 371395b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions doomsday/libs/core/src/data/block.cpp
Expand Up @@ -36,9 +36,12 @@ Block::Block(const iBlock *other)

Block::Block(const IByteArray &other)
{
init_Block(&_block, other.size());
const dsize num = other.size();
init_Block(&_block, num);
// Read the other's data directly into our data buffer.
other.get(0, data(), other.size());
other.get(0, data(), num);
// Ensure it's null-terminated.
data()[num] = 0;
}

Block::Block(const Block &other)
Expand Down

0 comments on commit 371395b

Please sign in to comment.