fix: strcmp protection with NULL args
This commit is contained in:
@ -4,6 +4,8 @@ int strcmp(const char *s1, const char *s2)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
if (!s1 || !s2)
|
||||
return -1;
|
||||
while (s1[i] == s2[i] && s1[i] != '\0')
|
||||
i++;
|
||||
return s1[i] - s2[i];
|
||||
|
Reference in New Issue
Block a user