summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmirl <schmirl>2007-05-07 12:25:11 +0000
committerschmirl <schmirl>2007-05-07 12:25:11 +0000
commit2b103196d6fb69336a14d9167dbda701ab135183 (patch)
tree5885ba33d422657c488bd9f7c2b13780d229800a
parentd93eec41f310f50f67fc78eb0ed33f3a00cf4e83 (diff)
downloadvdr-plugin-streamdev-2b103196d6fb69336a14d9167dbda701ab135183.tar.gz
vdr-plugin-streamdev-2b103196d6fb69336a14d9167dbda701ab135183.tar.bz2
Check vasprintf return code (thanks to rofafor)
-rw-r--r--server/connection.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/connection.c b/server/connection.c
index c5c076a..629ed1d 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -1,5 +1,5 @@
/*
- * $Id: connection.c,v 1.9 2007/05/07 11:43:23 schmirl Exp $
+ * $Id: connection.c,v 1.10 2007/05/07 12:25:11 schmirl Exp $
*/
#include "server/connection.h"
@@ -101,6 +101,12 @@ 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());