Browse Source

* Add a sanity check to the FIGlet font loader.

pull/1/head
Sam Hocevar sam 18 years ago
parent
commit
8cca295e10
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/figlet.c

+ 2
- 2
src/figlet.c View File

@@ -198,11 +198,11 @@ static int open_font(context_t *cx)
if(toigets(buf, 2048, f) == NULL) if(toigets(buf, 2048, f) == NULL)
break; break;


if(!buf[0])
if(!buf[0] || buf[0] < '0' || buf[0] > '9')
{ {
free(data); free(data);
free(cx->lookup); free(cx->lookup);
fprintf(stderr, "read error at glyph %u in `%s'\n",
fprintf(stderr, "read error at glyph #%u in `%s'\n",
cx->glyphs, path); cx->glyphs, path);
return -1; return -1;
} }


Loading…
Cancel
Save