$OpenBSD: patch-pdf_c,v 1.2 2020/04/01 15:42:40 fcambus Exp $

Index: pdf.c
--- pdf.c.orig
+++ pdf.c
@@ -154,7 +154,7 @@ pdfwfloat (double y) {
     ix = ixd;
   } while ((ix != 0) || (j <= 6));
   for (j = 1; j <= ln; j++) {
-    sprintf (STR1, "%c", ts[ln - j]);
+    snprintf (STR1, sizeof(STR1), "%c", ts[ln - j]);
     pdfstream (STR1, 1, &cx);
   }
 }
@@ -311,10 +311,10 @@ pdfwstring (nametype * p) {
     iswhite = ((c == etxch) || (c == nlch) || (c == tabch) || (c == ' '));
     if ((!iswhite) || (!waswhite)) {
       if ((c == bslch) || (c == ')') || (c == '(')) {
-	sprintf (STR1, "%c", bslch);
+	snprintf (STR1, sizeof(STR1), "%c", bslch);
 	pdfstream (STR1, 1, &cx);
       }
-      sprintf (STR1, "%c", c);
+      snprintf (STR1, sizeof(STR1), "%c", c);
       pdfstream (STR1, 1, &cx);
     }
     waswhite = iswhite;
@@ -850,7 +850,7 @@ pdfdraw (primitive * node) {
       pdfwpos (node->Upr.Uline.endpos);
       pdfstream (" l", 2, &cx);
       if (node->son != NULL) {
-	sprintf (STR1, "%c", nlch);
+	snprintf (STR1, sizeof(STR1), "%c", nlch);
 	pdfstream (STR1, 1, &cx);
       } else {
 	pdfwln (" S", 2, &cx);
@@ -929,7 +929,7 @@ pdfdraw (primitive * node) {
   case XLaTeX:
     if (node->textp != NULL) {
       pdfwstring (node->textp);
-      sprintf (STR1, "%c", nlch);
+      snprintf (STR1, sizeof(STR1), "%c", nlch);
       pdfstream (STR1, 1, &cx);
     }
     break;
