$NetBSD: patch-ba,v 1.2 2011/02/19 14:42:21 drochner Exp $

--- backend/dvi/mdvi-lib/afmparse.c.orig	2009-04-24 07:24:16.000000000 +0000
+++ backend/dvi/mdvi-lib/afmparse.c
@@ -160,7 +160,7 @@ static char *token(FILE *stream)
     
     idx = 0;
     while (ch != EOF && ch != ' ' && ch != lineterm 
-           && ch != '\t' && ch != ':' && ch != ';') 
+           && ch != '\t' && ch != ':' && ch != ';' && idx < (MAX_NAME - 1))
     {
         ident[idx++] = ch;
         ch = fgetc(stream);
@@ -190,7 +190,7 @@ static char *linetoken(FILE *stream)
     while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); 
     
     idx = 0;
-    while (ch != EOF && ch != lineterm) 
+    while (ch != EOF && ch != lineterm && idx < (MAX_NAME - 1)) 
     {
         ident[idx++] = ch;
         ch = fgetc(stream);
