From 779b337d042b12c31ca241de995b00a68461e83d Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 7 Dec 2011 18:30:25 +0100 Subject: fixed possible buffer overflow --- ts3db.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ts3db.c b/ts3db.c index 69085f4..30799c4 100644 --- a/ts3db.c +++ b/ts3db.c @@ -3,7 +3,7 @@ #include #include -#define MAX_CONNECTIONS 100 +#define MAX_CONNECTIONS 99 typedef struct { PGconn *conn; @@ -88,6 +88,10 @@ int ts3dbplugin_connect(unsigned int *connection_nr) { PGconn *conn; + if (connection_count >= MAX_CONNECTIONS) { + return 0; + } + conn = PQconnectdbParams(keywords, (const char **)&settings, true); if (PQstatus(conn) != CONNECTION_OK) { log(PQerrorMessage(conn), LOG_CRITICAL); -- cgit v1.2.3