summaryrefslogtreecommitdiff
path: root/print/gv/patches/patch-ac
blob: 105748fcf1e244b8468c0517cc0959d18f924934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$NetBSD: patch-ac,v 1.9 2006/11/21 13:58:10 tron Exp $

--- src/ps.c.orig	2006-07-07 16:35:49.000000000 +0100
+++ src/ps.c	2006-11-21 13:49:17.000000000 +0000
@@ -1396,6 +1396,8 @@
 	quoted=1;
 	line++;
 	while (*line && !(*line == ')' && level == 0 )) {
+	    if (cp - text >= PSLINELENGTH - 1)
+                break;
 	    if (*line == '\\') {
 		if (*(line+1) == 'n') {
 		    *cp++ = '\n';
@@ -1450,8 +1452,11 @@
 	    }
 	}
     } 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;