]> www.fi.muni.cz Git - evince.git/commitdiff
dvi: Another fix for buffer overwrite in dvi-backend
authorScott Reeves <sreeves@novell.com>
Sun, 20 Mar 2011 10:01:07 +0000 (11:01 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 20 Mar 2011 10:01:07 +0000 (11:01 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=643882

backend/dvi/mdvi-lib/afmparse.c

index e1cd1156e8d98a129978309291e56ba47ae70b68..f90e557567508f16a7664f9dd27f36e476f19a4f 100644 (file)
@@ -160,7 +160,7 @@ static char *token(FILE *stream)
     
     idx = 0;
     while (ch != EOF && ch != ' ' && ch != lineterm 
-           && ch != '\t' && ch != ':' && ch != ';' && idx < MAX_NAME)
+           && 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 && idx < MAX_NAME)
+    while (ch != EOF && ch != lineterm && idx < (MAX_NAME - 1))
     {
         ident[idx++] = ch;
         ch = fgetc(stream);