Reduce additional duplication

Extract function from spell_load_spell_file() to increase DRYness
Fix size calculation for snprintf

The previous refactoring failed to update the size calculation, and
introduced a classic "sizeof array vs. pointer" bug. This fixes it (in
an ugly way - this is about to change in upcoming commits).