diff -rupN leptonica-1.74.4/prog/htmlviewer.c leptonica-1.74.4-new/prog/htmlviewer.c
--- leptonica-1.74.4/prog/htmlviewer.c 2017-06-11 22:04:50.000000000 +0200
+++ leptonica-1.74.4-new/prog/htmlviewer.c 2018-02-22 13:19:04.671885796 +0100
@@ -171,9 +171,9 @@ SARRAY *safiles, *sathumbs, *saviews,
return ERROR_INT("safiles not made", procName, 1);
/* Generate output text file names */
- sprintf(charbuf, "%s/%s.html", dirout, rootname);
+ snprintf(charbuf, sizeof(charbuf), "%s/%s.html", dirout, rootname);
mainname = stringNew(charbuf);
- sprintf(charbuf, "%s/%s-links.html", dirout, rootname);
+ snprintf(charbuf, sizeof(charbuf), "%s/%s-links.html", dirout, rootname);
linkname = stringNew(charbuf);
linknameshort = stringJoin(rootname, "-links.html");
@@ -197,7 +197,7 @@ SARRAY *safiles, *sathumbs, *saviews,
pixGetDimensions(pix, &w, NULL, &d);
factor = (l_float32)thumbwidth / (l_float32)w;
pixthumb = pixScale(pix, factor, factor);
- sprintf(charbuf, "%s_thumb_%03d", rootname, index);
+ snprintf(charbuf, sizeof(charbuf), "%s_thumb_%03d", rootname, index);
sarrayAddString(sathumbs, charbuf, L_COPY);
outname = genPathname(dirout, charbuf);
WriteFormattedPix(outname, pixthumb);