Blob Blame History Raw
--- gv-3.6.1/src/ps.c.cve-2006-5864	2004-12-07 16:55:59.000000000 -0700
+++ gv-3.6.1/src/ps.c	2006-11-16 05:53:28.000000000 -0700
@@ -1433,6 +1433,8 @@ gettext(line, next_char)
 	quoted=1;
 	line++;
 	while (*line && !(*line == ')' && level == 0 )) {
+	    if (cp - text >= PSLINELENGTH - 1)
+		break;
 	    if (*line == '\\') {
 		if (*(line+1) == 'n') {
 		    *cp++ = '\n';
@@ -1487,9 +1489,12 @@ gettext(line, next_char)
 	    }
 	}
     } else {
-	while (*line && !(*line == ' ' || *line == '\t' || *line == '\n'))
+	while (*line && !(*line == ' ' || *line == '\t' || *line == '\n')) {
+	    if (cp - text >= PSLINELENGTH - 2)
+		break;
 	    *cp++ = *line++;
+	}
     }
     *cp = '\0';
     if (next_char) *next_char = line;
     if (!quoted && strlen(text) == 0) {ENDMESSAGE(gettext) return NULL;}