This isn't valid.  The result is not a null terminated string - so you can't use strcpy.

This also isn't filling in tgtLen.