classic-ui: fix possible buffer overflows #5250

Add checks to functions using strcat. Now the legth of the resulting
string gets calculated and checked if it would exceed the max length
for this char array.

Thanks to DTAG Group Information Security for the findings.

refs: #5250
whatthecommit: fixed my stupidness ...