Using alloca would be easier and more safe here, but not good for portability (if this is a feature).