[dcs] Add safe string length
[dcs] Add safelen tests
[dcs] Use safelen in cat functions, fix cat*

Fix: invalid use of len/max in cat*