diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2011-12-07 18:30:25 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2011-12-07 18:30:25 +0100 |
commit | 779b337d042b12c31ca241de995b00a68461e83d (patch) | |
tree | c98867666fae17cd446a28f83e4c9066e15411ba | |
parent | 4866aba384e9da075e963d99fc642ec5e6c809ca (diff) | |
download | ts3db_postgres-779b337d042b12c31ca241de995b00a68461e83d.tar.gz ts3db_postgres-779b337d042b12c31ca241de995b00a68461e83d.tar.xz ts3db_postgres-779b337d042b12c31ca241de995b00a68461e83d.zip |
fixed possible buffer overflow
Diffstat (limited to '')
-rw-r--r-- | ts3db.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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); |