commit 0edaf3361db01425cae0daee7dc3f6039f381a17 replaced several
malloc()+strcat() sequences with strncat() using strlen() on the
*source* string.
This is still vulnerable to overwrite the *target* buffer.
While reviewing this commit change the code to directly use snprintf()
for concatenating strings and check the length of the target buffer.
Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>