[dcs] Add safe string length
[dcs] Add safelen tests