swconfig: fix off-by-one error, causing segfaults on gcc 4.6+ (fixes #9765)