bloody c language
That is a problem in the compare routine. If the length of the strings is different it should return a mismatch. Checking if two strings are identical means a byte for byte match. If one string is different in length from the other it is an immediate fail. You don't even need to waste compute cycles to start comparing the byte arrays.
Speed optimized code would first check that both character arrays are same length. and only then attempt to compare. on the first mismatch : exit with a fail.