I guess the idea is that if the code does not crash at this line:
DEBUGASSERT(slen < dsize);
it means it succeeded. Although some compilers will remove the assertions in release builds.I would have preferred an explicit error code though.