Fix buffer size handling in metadata chunks.