Refactor: libcrmcommon: add internal API for replacing a dynamic string
This could be used in a few more places if it returned ENOMEM instead of
asserting on strdup() failure, but most callers assume the copy succeeded, so
asserting is better for now.