The destination buffer needs to have a size if I'm not mistaking. I'm on my phone and can test it right now, but I'm pretty sure I had the same problem once and fixed it like that. Try it. I'm 99% sure that's the problem.
//edit: lol, I just noticed... The "team" string in the function header has the same name with the "team" integer down below, so you're basically using "copy" on an integer. This is why szTeam and iTeam style names should be used.