]> granicus.if.org Git - neomutt/commitdiff
ensure that the buffer always exists in mutt_buffer_alloc()
authorRichard Russon <rich@flatcap.org>
Fri, 20 Sep 2019 13:08:50 +0000 (14:08 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 21 Sep 2019 17:11:48 +0000 (18:11 +0100)
mutt/buffer.c

index 12c891a5ec45f791dab7739011c871de84c6e12d..3ab6d628633d90f84ecbb02b3cbfcdf82f6fe3db 100644 (file)
@@ -274,7 +274,7 @@ void mutt_buffer_alloc(struct Buffer *buf, size_t new_size)
     buf->dptr = buf->data;
   }
 
-  if (new_size > buf->dsize)
+  if ((new_size > buf->dsize) || !buf->data)
   {
     size_t offset = (buf->dptr && buf->data) ? buf->dptr - buf->data : 0;