$OpenBSD: patch-kghostview_ps_c,v 1.1 2002/09/28 22:50:30 brad Exp $
--- kghostview/ps.c.orig	Mon Jan 28 16:05:43 2002
+++ kghostview/ps.c	Sat Sep 28 18:12:33 2002
@@ -71,9 +71,11 @@ pscopy(from, to, begin, end)
 	if (!(DSCcomment(line) && iscomment(line+2, "Begin"))) {
 	    /* Do nothing */
 	} else if (iscomment(line+7, "Data:")) {
+            int rc = 0;
 	    text[0] = '\0';
-	    if (sscanf(line+length("%%BeginData:"),
-		       "%d %*s %s", &num, text) >= 1) {
+	    rc = sscanf(line+length("%%BeginData:"), "%d %*s %256s", &num,text);
+            text[256] = '\0';
+            if (rc >= 1) {
 		if (strcmp(text, "Lines") == 0) {
 		    for (i=0; i < num; i++) {
 			fgets(line, sizeof line, from);
@@ -148,9 +150,11 @@ pscopyuntil(from, to, begin, end, commen
 	if (!(DSCcomment(line) && iscomment(line+2, "Begin"))) {
 	    /* Do nothing */
 	} else if (iscomment(line+7, "Data:")) {
+            int rc = 0;
 	    text[0] = '\0';
-	    if (sscanf(line+length("%%BeginData:"),
-		       "%d %*s %s", &num, text) >= 1) {
+	    rc = sscanf(line+length("%%BeginData:"), "%d %*s %256s", &num,text);
+            text[256] = '\0';
+            if (rc >= 1) {
 		if (strcmp(text, "Lines") == 0) {
 		    for (i=0; i < num; i++) {
 			fgets(line, sizeof line, from);
