MFC r279953:
Rework the concat() algorithm to be correct in all cases.
Sponsored by: The FreeBSD Foundation