You're using atoi, but I can't see where you're terminating the string. inData is too small, I think.