"make html" fails due to a bug in doc2web.c

"Jun. T" <[email protected]> Fri, 16 Dec 2022 01:04:59 +0900
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
'make html' fails on one of my Mac (intel CPU, macOS Mojave, a rather
old version). The problem is in docs/doc2web.c:

507                 } else {
508                     /* close current file and start a new one */
509                     char newfile[PATH_MAX] = "";
510 
511     end_of_titlepage:
(snip)
531                     /* open new file */
532                     strcat(newfile,path);
533                     strncat(newfile,location,PATH_MAX-strlen(newfile)-6);

If we jump into this block by 'goto end_of_titlepage', then newfile[0] is
not initialized to '\0', and the strcat() at line 532 does not work as expected.
This does not happen on other Macs or on Linux, but I guess C language standard
does not guarantee that newfile is initialized after goto.

We can simply fix this by replacing strcat() at line 532 by
strcpy(newfile, path);

(and the initializer = "" at the end of line 509 is redundant)

_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta