File: 028-man2html-segfault.patch

package info (click to toggle)
man2html 1.6f%2Brepack-1%2Bsqueeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,416 kB
  • ctags: 2,894
  • sloc: ansic: 9,558; sh: 2,301; makefile: 343; perl: 335; awk: 305; lisp: 171; cs: 170
file content (78 lines) | stat: -rw-r--r-- 2,203 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Fix segfault when viewing groff(7) page.

diff -ruN -x '*.rej' -x '*.orig' man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
--- man-1.6e-old/man2html/man2html.c	2007-04-23 17:33:44.000000000 +0200
+++ man-1.6e/man2html/man2html.c	2007-04-23 17:33:45.000000000 +0200
@@ -1673,7 +1673,7 @@
 
     int i,j,mode = 0;
     char *h;
-    char *wordlist[20];
+    char *wordlist[30];
     int words;
     char *sl;
     LONGSTRDEF *owndef;
@@ -1713,7 +1713,7 @@
 		    if (mandoc_command)
 			 scan_troff_mandoc(wordlist[i],1,&h);
 		    else
-			 scan_troff(wordlist[i],1,&h);
+			 scan_troff(wordlist[i],2,&h);
 		    wordlist[i]=h;
 		}
 		for (i=words; i<SIZE(wordlist); i++)
@@ -1731,6 +1731,7 @@
 		newline_for_fun=onff;
 		argument=oldargument;
 		for (i=0; i<words; i++) if (wordlist[i]) free(wordlist[i]);
+		owndef->st[deflen+1]=0;
 		*sl='\n';
 	} else switch (i) {
 	case V('a','b'):
@@ -2426,12 +2427,13 @@
 		    j=3;
 		}
 		c=sl+1;
+		*sl=0;
 		sl=c;
 		while (*c && strncmp(c,wordlist[1],j)) c=skip_till_newline(c);
 		de = find_longstrdef(defdef, i, longname, &longname); 
 		if (mode && de) olen=strlen(de->st);
 		j=olen+c-sl;
-		h= (char*) xmalloc((j*2+4)*sizeof(char));
+		h= (char*) xmalloc((j*2+5)*sizeof(char));
 		if (h) {
 		    for (j=0; j<olen; j++)
 			h[j]=de->st[j];
@@ -2452,6 +2454,7 @@
 			de = (LONGSTRDEF*) xmalloc(sizeof(LONGSTRDEF));
 			de->nr=i;
 			de->longname=longname;
+			de->slen=0;
 			de->next=defdef;
 			de->st=h;
 			defdef=de;
@@ -2997,12 +3000,12 @@
 	    h++;
 	    FLUSHIBP;
 	    h = scan_escape(h);
-	} else if (*h == controlsym && h[-1] == '\n') {
+	} else if (san != 2 && *h == controlsym && h[-1] == '\n') {
 	    h++;
 	    FLUSHIBP;
 	    h = scan_request(h);
 	    if (san && h[-1] == '\n') h--;
-	} else if (mandoc_line
+	} else if (san != 2 && mandoc_line
 		   && *(h) && isupper(*(h))
 		   && *(h+1) && islower(*(h+1))
 		   && *(h+2) && isspace(*(h+2))) {
@@ -3010,7 +3013,7 @@
 	     FLUSHIBP;
 	     h = scan_request(h);
 	     if (san && h[-1] == '\n') h--;
-	} else if (*h == nobreaksym && h[-1] == '\n') {
+	} else if (san != 2 && *h == nobreaksym && h[-1] == '\n') {
 	    h++;
 	    FLUSHIBP;
 	    h = scan_request(h);