Allocate buffer large enough not only if size == 0, but also for size < 0.