I have a function that will parse some data coming in. My problem is that after using strncpy I get some garbage when I try to print it. I try using malloc to make the char
Your results are because strncpy does not put a null character at the end of the string.
strncpy