openbsd-ports/www/webalizer/patches/patch-graphs_c
mbalmer 6ba8133cdd Switch to webalizer xtended by Patrick Frei, which adds IPv6 support and
detailed http 404 error reports.  Webalizer author hinted me at this,
he does not intend to update. danh@ is ok with the maintainer change.

ok stehn, okan.
2008-01-30 20:06:48 +00:00

75 lines
3.0 KiB
Plaintext

$OpenBSD: patch-graphs_c,v 1.2 2008/01/30 20:06:48 mbalmer Exp $
--- graphs.c.orig Tue Aug 7 13:25:17 2007
+++ graphs.c Wed Jan 30 13:42:39 2008
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
+#include <sys/socket.h>
#include <gd.h>
#include <gdfontt.h>
#include <gdfonts.h>
@@ -198,7 +199,7 @@ int year_graph6x( char *fname, /* file nam
if (data7[i] > maxval) maxval = data7[i];
}
if (maxval <= 0) maxval = 1;
- sprintf(maxvaltxt, "%lu", maxval);
+ snprintf(maxvaltxt, sizeof maxvaltxt, "%lu", maxval);
gdImageStringUp(im,gdFontSmall,8,26+(strlen(maxvaltxt)*6),maxvaltxt,CHLEGENDCOLOR);
if (graph_legend) /* print color coded legends? */
@@ -292,7 +293,7 @@ int year_graph6x( char *fname, /* file nam
if (data8[i] > maxval) maxval = data8[i];
}
if (maxval <= 0) maxval = 1;
- sprintf(maxvaltxt, "%lu", maxval);
+ snprintf(maxvaltxt, sizeof maxvaltxt, "%lu", maxval);
gdImageStringUp(im, gdFontSmall,493,26+(strlen(maxvaltxt)*6),
maxvaltxt,CHLEGENDCOLOR);
@@ -331,7 +332,7 @@ int year_graph6x( char *fname, /* file nam
if (data6[i] > fmaxval) fmaxval = data6[i]; /* get max val */
}
if (fmaxval <= 0.0) fmaxval = 1.0;
- sprintf(maxvaltxt, "%.0f", fmaxval);
+ snprintf(maxvaltxt, sizeof maxvaltxt, "%.0f", fmaxval);
gdImageStringUp(im, gdFontSmall,493,130+(strlen(maxvaltxt)*6),
maxvaltxt,CHLEGENDCOLOR);
@@ -458,7 +459,7 @@ int month_graph6( char *fname, /* filename
if (data7[i] > maxval) maxval = data7[i];
}
if (maxval <= 0) maxval = 1;
- sprintf(maxvaltxt, "%lu", maxval);
+ snprintf(maxvaltxt, sizeof maxvaltxt, "%lu", maxval);
gdImageStringUp(im, gdFontSmall,8,26+(strlen(maxvaltxt)*6),
maxvaltxt,CHLEGENDCOLOR);
@@ -555,7 +556,7 @@ int month_graph6( char *fname, /* filename
if (data8[i]>maxval) maxval = data8[i];
}
if (maxval <= 0) maxval = 1;
- sprintf(maxvaltxt, "%lu", maxval);
+ snprintf(maxvaltxt, sizeof maxvaltxt, "%lu", maxval);
gdImageStringUp(im, gdFontSmall,8,224+(strlen(maxvaltxt)*6),
maxvaltxt,CHLEGENDCOLOR);
@@ -590,7 +591,7 @@ int month_graph6( char *fname, /* filename
if (data6[i]>fmaxval) fmaxval = data6[i];
}
if (fmaxval <= 0.0) fmaxval = 1.0;
- sprintf(maxvaltxt, "%.0f", fmaxval/1024);
+ snprintf(maxvaltxt, sizeof maxvaltxt, "%.0f", fmaxval/1024);
gdImageStringUp(im, gdFontSmall,8,352+(strlen(maxvaltxt)*6),
maxvaltxt,CHLEGENDCOLOR);
@@ -679,7 +680,7 @@ int day_graph3( char *fname,
if (data3[i] > maxval) maxval = data3[i];
}
if (maxval <= 0) maxval = 1;
- sprintf(maxvaltxt, "%lu", maxval);
+ snprintf(maxvaltxt, sizeof maxvaltxt, "%lu", maxval);
gdImageStringUp(im, gdFontSmall, 8, 26+(strlen(maxvaltxt)*6),
maxvaltxt,CHLEGENDCOLOR);