buffer: add a little protection to mongoc-buffer.