summaryrefslogtreecommitdiff
path: root/chat/centerim/patches/patch-av
blob: 5f0c5a2caf6e6b405ee5e9e63ab40b191969975e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$NetBSD: patch-av,v 1.1.1.1 2007/08/30 00:47:02 jnemeth Exp $

--- src/hooks/abstracthook.cc.orig	2007-07-19 02:24:38.000000000 +0200
+++ src/hooks/abstracthook.cc
@@ -40,6 +40,8 @@
 
 #include <time.h>
 
+#define NOTIFBUF 512
+
 time_t timer_current = time(0);
 
 abstracthook::abstracthook(protocolname aproto)
@@ -339,7 +341,7 @@ bool abstracthook::regattempt(unsigned i
 
 void abstracthook::log(logevent ev, ...) {
     va_list ap;
-    char buf[512];
+    char buf[NOTIFBUF];
     static map<logevent, string> lst;
 
     if(lst.empty()) {
@@ -354,7 +356,8 @@ void abstracthook::log(logevent ev, ...)
     }
 
     va_start(ap, ev);
-    vsprintf(buf, lst[ev].c_str(), ap);
+    vsnprintf(buf, NOTIFBUF, lst[ev].c_str(), ap);
+    buf[NOTIFBUF-1] = '\0';
     va_end(ap);
 
     face.log((string) "+ [" + conf.getprotocolname(proto)  + "] " + buf);
@@ -751,7 +754,7 @@ string abstracthook::getTimezoneIDtoStri
     if(id > 24 || id < -24) {
 	return "Unspecified";
     } else {
-	char buf[32];
+	static char buf[32];
 	sprintf(buf, "GMT %s%d:%s", id > 0 ? "-" : "+", abs(id/2), id % 2 == 0 ? "00" : "30");
 	return buf;
     }