Did you fix the problem with strncpy not appending a null?

What I do in cases like this ideally is to step through the program with a debugger, but if I can't do that then I add a load of printf statements to say what the program is doing at any point. This kind of logging can be very helpful in tracking down a problem, for example if you can see that it has copied, say, (a(b) when you expected it to copy (a(b)) then you can look more closely that the code that does that to try to figure out where it is going wrong.