roff: safer strcpy() and sprintf() calls

This is based on a patch by Dirk-Wilhelm Peters <peters@schwertfisch.de>.