$NetBSD: patch-av,v 1.1 2007/07/19 00:43:40 lkundrak Exp $ --- src/hooks/abstracthook.cc.orig 2007-07-19 02:24:38.000000000 +0200 +++ src/hooks/abstracthook.cc @@ -40,6 +40,8 @@ #include +#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 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; }