Skip to content
Snippets Groups Projects
Commit 639120de authored by Franza, Simone's avatar Franza, Simone
Browse files

inputs longer than SIZE_BUFFER are now refused

parent bdc8ce58
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,12 @@ int checkStringValidity(char *text, int max_length, OperationType op) ...@@ -42,6 +42,12 @@ int checkStringValidity(char *text, int max_length, OperationType op)
int string_length = stringLength(text); int string_length = stringLength(text);
if(text[string_length - 1] == '\n') if(text[string_length - 1] == '\n')
text[string_length-- - 1] = '\0'; text[string_length-- - 1] = '\0';
else
{
int character;
while((character = getchar()) != '\n' && character != EOF);
return 0;
}
int number_of_letters = containsOnlyAlpha(text); int number_of_letters = containsOnlyAlpha(text);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment