6035b15ee1
- fixes two memory leaks, one serious - quite some filter changes, upgraders beware! - for details, see http://www.privoxy.org/announce.txt from MAINTAINER
56 lines
2.4 KiB
Plaintext
56 lines
2.4 KiB
Plaintext
$OpenBSD: patch-errlog_c,v 1.2 2003/04/01 20:52:59 sturm Exp $
|
|
--- errlog.c.orig Thu Mar 6 22:41:04 2003
|
|
+++ errlog.c Sat Mar 29 18:17:02 2003
|
|
@@ -564,7 +564,7 @@ void log_error(int loglevel, char *fmt,
|
|
case 'd':
|
|
ival = va_arg( ap, int );
|
|
oldoutc = outc;
|
|
- outc += sprintf(tempbuf, "%d", ival);
|
|
+ outc += snprintf(tempbuf, sizeof(tempbuf), "%d", ival);
|
|
if (outc < BUFFER_SIZE-1)
|
|
{
|
|
strcpy(outbuf + oldoutc, tempbuf);
|
|
@@ -577,7 +577,7 @@ void log_error(int loglevel, char *fmt,
|
|
case 'u':
|
|
uval = va_arg( ap, unsigned );
|
|
oldoutc = outc;
|
|
- outc += sprintf(tempbuf, "%u", uval);
|
|
+ outc += snprintf(tempbuf, sizeof(tempbuf), "%u", uval);
|
|
if (outc < BUFFER_SIZE-1)
|
|
{
|
|
strcpy(outbuf + oldoutc, tempbuf);
|
|
@@ -594,13 +594,13 @@ void log_error(int loglevel, char *fmt,
|
|
{
|
|
lval = va_arg( ap, long );
|
|
oldoutc = outc;
|
|
- outc += sprintf(tempbuf, "%ld", lval);
|
|
+ outc += snprintf(tempbuf, sizeof(tempbuf), "%ld", lval);
|
|
}
|
|
else if (ch == 'u')
|
|
{
|
|
ulval = va_arg( ap, unsigned long );
|
|
oldoutc = outc;
|
|
- outc += sprintf(tempbuf, "%lu", ulval);
|
|
+ outc += snprintf(tempbuf, sizeof(tempbuf), "%lu", ulval);
|
|
}
|
|
else
|
|
{
|
|
@@ -700,7 +700,7 @@ void log_error(int loglevel, char *fmt,
|
|
#endif /* ndef HAVE_STRERROR */
|
|
if (sval == NULL)
|
|
{
|
|
- sprintf(tempbuf, "(errno = %d)", ival);
|
|
+ snprintf(tempbuf, sizeof(tempbuf), "(errno = %d)", ival);
|
|
sval = tempbuf;
|
|
}
|
|
#endif /* ndef _WIN32 */
|
|
@@ -754,7 +754,7 @@ void log_error(int loglevel, char *fmt,
|
|
hrs = ((days < -1 ? 24 : 1 < days ? -24 : days * 24) + tm_now->tm_hour - gmt.tm_hour);
|
|
mins = hrs * 60 + tm_now->tm_min - gmt.tm_min;
|
|
strftime (tempbuf, BUFFER_SIZE-6, "%d/%b/%Y:%H:%M:%S ", tm_now);
|
|
- sprintf (tempbuf + strlen(tempbuf), "%+03d%02d", mins / 60, abs(mins) % 60);
|
|
+ snprintf (tempbuf + strlen(tempbuf), sizeof(tempbuf) - strlen(tempbuf), "%+03d%02d", mins / 60, abs(mins) % 60);
|
|
}
|
|
oldoutc = outc;
|
|
outc += strlen(tempbuf);
|