[dcs] Use safelen in cat functions, fix cat*

Fix: invalid use of len/max in cat*