4931932
diff -up tetex-src-3.0/libs/t1lib/t1env.c.CVE-2007-4033 tetex-src-3.0/libs/t1lib/t1env.c
4931932
--- tetex-src-3.0/libs/t1lib/t1env.c.CVE-2007-4033	2004-01-27 23:26:31.000000000 +0100
4931932
+++ tetex-src-3.0/libs/t1lib/t1env.c	2007-11-02 12:48:20.000000000 +0100
4931932
@@ -568,6 +568,12 @@ char *intT1_Env_GetCompletePath( char *F
4931932
 #endif 
4931932
     strcat( pathbuf, DIRECTORY_SEP);
4931932
     /* And finally the filename: */
4931932
+    /* If current pathbuf + StrippedName + 1 byte for NULL is bigger than pathbuf
4931932
+       let's try next pathbuf */
4931932
+    if( strlen(pathbuf) + strlen(StrippedName) + 1 > sizeof(pathbuf) ) {
4931932
+	i++;
4931932
+    	continue;
4931932
+    }
4931932
     strcat( pathbuf, StrippedName);
4931932
     
4931932
     /* Check for existence of the path: */