summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2011-12-07 18:30:25 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2011-12-07 18:30:25 +0100
commit779b337d042b12c31ca241de995b00a68461e83d (patch)
treec98867666fae17cd446a28f83e4c9066e15411ba
parent4866aba384e9da075e963d99fc642ec5e6c809ca (diff)
downloadts3db_postgres-779b337d042b12c31ca241de995b00a68461e83d.tar.gz
ts3db_postgres-779b337d042b12c31ca241de995b00a68461e83d.tar.xz
ts3db_postgres-779b337d042b12c31ca241de995b00a68461e83d.zip
fixed possible buffer overflow
Diffstat (limited to '')
-rw-r--r--ts3db.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ts3db.c b/ts3db.c
index 69085f4..30799c4 100644
--- a/ts3db.c
+++ b/ts3db.c
@@ -3,7 +3,7 @@
#include <stdbool.h>
#include <string.h>
-#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);