imap: fix oob write during debug on 32 bit systems
If an imap server returns a length of 4294967285 bytes for message
headers, then buffer allocation in imap_read_literal may lead to a 0
byte allocation in mutt_buffer_alloc on 32 bit systems.
The allocation itself at this point is a realloc(NULL, 0). The result
is implementation-dependent. Systems might return NULL or return a
pointer which, according to standard, may only be passed to free.
But mutt_buffer_alloc writes '\0' into the memory. This actually works
on Linux with glibc, but OpenBSD is quite strict about it and crashes
the program.
Last but not least requirement to reproduce this: neomutt must be
run with a debug level of at least IMAP_LOG_LTRL.
Signed-off-by: Tobias Stoeckmann <[email protected]>