diff -ur t1lib-5.1.2.orig/lib/t1lib/parseAFM.c t1lib-5.1.2/lib/t1lib/parseAFM.c
--- lib/t1lib/parseAFM.c	2007-12-23 16:49:42.000000000 +0100
+++ lib/t1lib/parseAFM.c	2011-04-13 20:48:00.000000000 +0200
@@ -179,6 +179,8 @@
 
 /*************************** PARSING ROUTINES **************/ 
   
+#define MAX_NAME_1 MAX_NAME-1   /* check for buffer overflow */
+
 /*************************** token *************************/
 
 /*  A "AFM File Conventions" tokenizer. That means that it will
@@ -198,7 +200,8 @@
     
     idx = 0;
     
-    while (ch != EOF && ch != ' ' && ch != CR  && ch != LF &&
+    while (idx < MAX_NAME_1 &&
+	   ch != EOF && ch != ' ' && ch != CR  && ch != LF &&
 	   ch != CTRL_Z && ch != '\t' && ch != ':' && ch != ';'){
       ident[idx++] = ch;
       ch = fgetc(stream);
@@ -235,7 +238,7 @@
     while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); 
     
     idx = 0;
-    while (ch != EOF && ch != CR  && ch != LF && ch != CTRL_Z) 
+    while (idx < MAX_NAME_1 && ch != EOF && ch != CR  && ch != LF && ch != CTRL_Z) 
     {
         ident[idx++] = ch;
         ch = fgetc(stream);