]> granicus.if.org Git - neomutt/commit
Ensure a resized empty buffer is null-terminated
authorKevin McCarthy <kevin@8t8.us>
Wed, 17 Oct 2018 00:35:54 +0000 (17:35 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 26 Nov 2018 18:27:21 +0000 (18:27 +0000)
commit2893bc652055b00eb963f942d2556f9c195a8a70
tree72c649d1aae5bd90ee23e9ab0818c7926e2d3e70
parent2a7b44c5e31c7da3ab0967eeef8d61e7f196e729
Ensure a resized empty buffer is null-terminated

The new buffer code is using the pool, which ensures its buffers are
null-terminated.

However, if a "new" buffer from another part of the code were passed
to one of the temporary interfaces that resizes the buffer, it's
possible a non-terminated string might end up being passed through.

It's reasonable to expect mutt_b2s() for a "new" buffer should be the
same as after it is resized larger.  So ensure the resulting buf->data
is properly terminated to avoid surprises.
mutt/buffer.c