We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4c99fed + 1fbf053 commit c9532abCopy full SHA for c9532ab
chapter_5/exercise_5_07/readlines.c
@@ -48,7 +48,7 @@ int readlines(char *line_ptr[], int max_nr_of_lines, char *stored_lines)
48
{
49
// Checking if the current # of lines exceeds the max # of lines that can be stored
50
// Also checking if the max # of chars from the stored_lines buffer is not exceeded
51
- if (nr_of_lines >= max_nr_of_lines || (strlen(stored_lines) + len) > MAXSTORE)
+ if (nr_of_lines >= max_nr_of_lines || stored_lines + MAXSTORE - p < len)
52
53
return -1;
54
}
0 commit comments