$OpenBSD: patch-output_c,v 1.2 2008/01/30 20:06:48 mbalmer Exp $
--- output.c.orig	Tue Aug  7 13:28:49 2007
+++ output.c	Wed Jan 30 13:42:20 2008
@@ -38,6 +38,7 @@
 #include <ctype.h>
 #include <sys/utsname.h>
 #include <sys/times.h>
+#include <sys/socket.h>
 #include <stddef.h>
 
 /* ensure limits */
@@ -569,7 +570,7 @@ void month_links()
    char index_fname[256];
    
    fprintf(out_fp,"<SMALL>\n");
-   sprintf(index_fname,"index.%s",html_ext);
+   snprintf(index_fname,sizeof index_fname, "index.%s",html_ext);
    fprintf(out_fp, "<A HREF=\"%s\">[%s]</A>\n", index_fname, msg_hlnk_in);
    if (ntop_notfound && response[21].count)
       fprintf(out_fp,"<A HREF=\"#ERRORSTATS\">[%s]</A>\n",msg_hlnk_nf);
@@ -818,8 +819,8 @@ void month_total_table()
          }
       }
 
-      sprintf(pie_title,"%s %s %d",msg_mtot_rc,l_month[cur_month-1],cur_year);
-      sprintf(pie_fname,"responses_%04d%02d.png",cur_year,cur_month);
+      snprintf(pie_title,sizeof pie_title,"%s %s %d",msg_mtot_rc,l_month[cur_month-1],cur_year);
+      snprintf(pie_fname,sizeof pie_fname,"responses_%04d%02d.png",cur_year,cur_month);
       
       pie_chart(pie_fname,pie_title,t_hit,pie_data,pie_legend);
       
@@ -971,12 +972,12 @@ int all_errors_page()
    int i;
 
    /* generate file name */
-   sprintf(error_fname,"error_%04d%02d.%s",cur_year,cur_month,html_ext);
+   snprintf(error_fname,sizeof error_fname,"error_%04d%02d.%s",cur_year,cur_month,html_ext);
 
    /* open file */
    if ( (out_fp=open_out_file(error_fname))==NULL ) return 0;
 
-   sprintf(buffer,"%s %d - %s",l_month[cur_month-1],cur_year,msg_h_url);
+   snprintf(buffer,sizeof buffer,"%s %d - %s",l_month[cur_month-1],cur_year,msg_h_url);
    write_html_head(buffer, out_fp);
 
    fprintf(out_fp,"<FONT SIZE=\"-1\"></CENTER><PRE>\n");
