From 1a25ab508743cfdefaedaa351620bb0d78f50f03 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Mon, 16 May 2016 21:24:23 +1200 Subject: Detect when no token of allowable chars can be read --- pgm-interlace.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; } -- cgit v1.1