diff options
Diffstat (limited to 'server/connection.c')
-rw-r--r-- | server/connection.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/connection.c b/server/connection.c index dff1945..629ed1d 100644 --- a/server/connection.c +++ b/server/connection.c @@ -1,5 +1,5 @@ /* - * $Id: connection.c,v 1.8 2007/01/15 12:00:19 schmirl Exp $ + * $Id: connection.c,v 1.10 2007/05/07 12:25:11 schmirl Exp $ */ #include "server/connection.h" @@ -101,9 +101,16 @@ bool cServerConnection::Respond(const char *Message, bool Last, ...) length = vasprintf(&buffer, Message, ap); va_end(ap); + if (length < 0) { + esyslog("ERROR: streamdev: buffer allocation failed (%s) for %s:%d", + m_Protocol, RemoteIp().c_str(), RemotePort()); + return false; + } + if (m_WriteBytes + length + 2 > sizeof(m_WriteBuffer)) { esyslog("ERROR: streamdev: output buffer overflow (%s) for %s:%d", m_Protocol, RemoteIp().c_str(), RemotePort()); + free(buffer); return false; } Dprintf("OUT: |%s|\n", buffer); |