patch to avoid crash when message without type is sent

also replaced strcat and strcpy with _s equivalents to avoid a crash in VC++