Sophie

Sophie

distrib > Fedora > 16 > x86_64 > media > updates-src > by-pkgid > 6dac609297e96702b39b0b4c51ed74d9 > files > 11

man2html-1.6-7.g.fc16.src.rpm

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);