aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2016-05-16 21:24:23 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2016-05-16 21:24:23 +1200
commit1a25ab508743cfdefaedaa351620bb0d78f50f03 (patch)
treed77a4c07960a853bc0e7b7e95221422531faa16d
parent8c04734d052fcea040de269457051539a57bab18 (diff)
downloadpgm-interlace-1a25ab508743cfdefaedaa351620bb0d78f50f03.tar.xz
Detect when no token of allowable chars can be read
-rw-r--r--pgm-interlace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pgm-interlace.c b/pgm-interlace.c
index fbc1cc8..eeaade4 100644
--- a/pgm-interlace.c
+++ b/pgm-interlace.c
@@ -136,6 +136,12 @@ int read_token(FILE *fd, char *token, size_t token_size, const char *allowable)
token[t] = '\0';
+ if (strlen(token) == 0)
+ {
+ fprintf(stderr, "read_token: no token available\n");
+ return 1;
+ }
+
return 0;
}