Replace strcmp() with strncmp(). There was a comparison being done on a character array that wasn't a true c-style string and wasn't null terminated