Failed to terminate correctly at n < strlen(s2). Fixed. Thanks to the bug reporter.