Skip to content

Commit

Permalink
Fix for infinite recursive loop problem in load_pnm() (#85),
Browse files Browse the repository at this point in the history
  • Loading branch information
saitoha committed Dec 17, 2019
1 parent 41f6be4 commit b418f35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/frompnm.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ pnm_get_line(unsigned char *p, unsigned char *end, unsigned char *line)
int n;

do {
/* read the line */
for (n = 0 ; p < end && *p >= ' '; p++) {
if (n < 255) {
line[n++] = *p;
}
}

if (p < end && *p == '\n') {
/* skip invald characters */
if (p < end && *p < ' ') {
p++;
}

Expand Down

0 comments on commit b418f35

Please sign in to comment.