groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Groff] Re: small patches


From: Gaius Mulley
Subject: [Groff] Re: small patches
Date: Fri, 20 Jul 2001 15:36:28 +0100

Hi Werner,

here are two small patches. The first removes a potential buffer overrun
and the second tidies up the doc/ directory by placing all png images
within a sub directory.

Ralph, I've modified the doc/.cvsignore file to include the image directory.
I presume this is legal in the world of cvs? I've checked the cvs(5) page
but it was not clear to me whether this is legal/illegal.

Regarding the image cropping problem, my GNU/Linux workstation at work
(network upgraded debian stable release) exhibits the problems you
mentioned but my debian potato release (circa 12 months ago) at home
does not. Guess I going to have to check the verions of gs and png utils
and see why and how they differ..

Gaius



--- groff-cvs/src/preproc/html/pre-html.cc      Fri Jul 20 08:43:40 2001
+++ groff-html/src/preproc/html/pre-html.cc     Fri Jul 20 15:11:58 2001
@@ -102,6 +102,7 @@
 static int   vertical_offset= DEFAULT_VERTICAL_OFFSET;
 static char *image_template = NULL;             // image template filename
 static int   troff_arg      = 0;                // troff arg index
+static char *command_prefix = NULL;             // optional prefix for some 
installations.
 static char *image_dir      = NULL;             // user specified image 
directory
 #if defined(DEBUGGING)
 static int   debug          = FALSE;
@@ -836,16 +837,17 @@
 
 static int createAllPages (void)
 {
-  char buffer[4096];
+  char *buffer;
   char *s;
   int retries = MAX_RETRIES;
 
   imagePageStem = xtmptemplate(PAGE_TEMPLATE_LONG, PAGE_TEMPLATE_SHORT);
-  strcpy(buffer, imagePageStem);
+  buffer = strsave(imagePageStem);
 
   do {
     if (mktemp(imagePageStem) == NULL) {
       sys_fatal("mktemp");
+      a_delete buffer;
       return -1;
     }
     if (mkdir(imagePageStem, 0700) == 0) break;
@@ -855,11 +857,13 @@
       if (retries == 0) {
        // time to give up
        sys_fatal("mkdir");
+       a_delete buffer;
        return -1;
       }
     } else {
       // another error, quit
       sys_fatal("mkdir");
+      a_delete buffer;
       return -1;
     }      
     strcpy(imagePageStem, buffer);
@@ -880,6 +884,7 @@
   fflush(stderr);
 #endif
   html_system(s, 1);
+  a_delete buffer;
   a_delete s;
   return 0;
 }
--- groff-cvs/doc/.cvsignore    Fri Jul 20 08:43:31 2001
+++ groff-html/doc/.cvsignore   Fri Jul 20 15:13:53 2001
@@ -1,4 +1,4 @@
-grohtml-*-*.png
+img
 homepage.html
 meintro.ps
 meref.ps
--- groff-cvs/doc/Makefile      Thu Jul 19 08:35:08 2001
+++ groff-html/doc/Makefile     Fri Jul 20 11:16:29 2001
@@ -68,7 +68,7 @@
        GROFF_BIN_PATH=$(groff_bin_path); \
        export GROFF_BIN_PATH; \
        sed -e "s;@VERSION@;$(version)$(revision);" $< \
-       | $(GROFF) -Thtml $(FFLAG) -U -ms >$@
+       | $(GROFF) -P-I$< -P-D -Pimg -Thtml $(FFLAG) -U -ms >$@
 
 .ms.ascii:
        GROFF_TMAC_PATH=../tmac; \
@@ -99,6 +99,7 @@
        -rm -f *.aux *.dvi *.log *.toc texput.log
        -rm -f *.cp *.cps *.cv *.cn *.fn *.fns *.gl *.gls *.ky *.kys \
                *.ma *.mas *.op *.ops *.pg *.pgs *.tp *.tps *.tr *.vr *.vrs
+       -rm -rf img
 
 distclean: clean
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]