Do not pass negative sizes to strncat or strncmp in tests.

These parameters are of type size_t, which is unsigned.
This commit is contained in:
Stephen Heumann 2024-02-24 18:57:50 -06:00
parent 84fdb5c975
commit ce94f4e2b6
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ second string argument!"))
goto Fail;
strcpy(s1, "this is the first string argument");
strcpy(s1, strncat (s1, s2, -5));
strcpy(s1, strncat (s1, s2, 0));
if (strcmp (s1, "this is the first string argument"))
goto Fail;

View File

@ -29,7 +29,7 @@ int main (void)
if (i != 0)
goto Fail;
i = strncmp (s1, s2, -90L); /* should just return 0 */
i = strncmp (s1, s2, 0L); /* should just return 0 */
if (i != 0)
goto Fail;