$OpenBSD: patch-src_mcl_expand_c,v 1.1 2005/07/26 18:50:43 naddy Exp $
--- src/mcl/expand.c.orig	Sat Jul 23 15:09:14 2005
+++ src/mcl/expand.c	Sat Jul 23 15:13:31 2005
@@ -963,38 +963,38 @@ void mclExpandAppendLog
    ;  char buf[100]
 
    ;  for (z=0;z<s->n_windows;z++)
-      sprintf(buf+3*z, "%3d", (int) (100.0*s->mass_prune_low[z]))
-   ;  sprintf
-      (buf+3*s->n_windows, " %3d", (int)(100.0*s->mass_prune_all))
+      snprintf(buf+3*z, (sizeof buf) - (size_t)(3*z), "%3d", (int) (100.0*s->mass_prune_low[z]))
+   ;  snprintf
+      (buf+3*s->n_windows, (sizeof buf) - (size_t)(3*s->n_windows), " %3d", (int)(100.0*s->mass_prune_all))
    ;  mcxTingNAppend(Log, buf, 3 * s->n_windows + 4)
    ;  mcxTingAppend(Log, "                                ")
-   ;  sprintf(buf, " %8d\n", (int) s->n_recoveries)
+   ;  snprintf(buf, sizeof buf, " %8d\n", (int) s->n_recoveries)
    ;  for (z=1;*(buf+z+1)==' ';z++)
       *(buf+z) ='.'
    ;  mcxTingAppend(Log, buf)
 
    ;  for (z=0;z<s->n_windows;z++)
-      sprintf(buf+3*z, "%3d", (int) (100.0*s->mass_final_low[z]))
-   ;  sprintf
-      (buf+3*s->n_windows, " %3d ", (int)(100.0*s->mass_final_all))
+      snprintf(buf+3*z, (sizeof buf) - (size_t)(3*z), "%3d", (int) (100.0*s->mass_final_low[z]))
+   ;  snprintf
+      (buf+3*s->n_windows, (sizeof buf) - (size_t)(3*s->n_windows), " %3d ", (int)(100.0*s->mass_final_all))
    ;  mcxTingNAppend(Log, buf, 3 * s->n_windows + 5)
    ;  mcxTingAppend(Log, s->levels_expand->str)
    ;  mcxTingAppend(Log, " ")
    ;  mcxTingAppend(Log, s->levels_prune->str)
-   ;  sprintf(buf, " %8d\n", (int) s->n_selects)
+   ;  snprintf(buf, sizeof buf,  " %8d\n", (int) s->n_selects)
    ;  for (z=1;*(buf+z+1)==' ';z++)
       *(buf+z) ='.'
    ;  mcxTingAppend(Log, buf)
 
    ;  mcxTingKAppend(Log, "-", 3* s->n_windows + 4)
    ;  mcxTingAppend(Log, " --------------- ---------------")
-   ;  sprintf(buf, " %8d\n", (int) s->n_below_pct)
+   ;  snprintf(buf, sizeof buf,  " %8d\n", (int) s->n_below_pct)
    ;  for (z=1;*(buf+z+1)==' ';z++)
       *(buf+z) ='-'
    ;  mcxTingAppend(Log, buf)
 
-   ;  sprintf
-      (  buf
+   ;  snprintf
+      (  buf, sizeof buf
       ,  "ite %d time %.2f chaos %.2f/%.2f\n"
       ,  (int) n_ite
       ,  (double) s->lap
