summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-06-04 21:38:03 +0200
committerattilamolnar <attilamolnar@hush.com>2013-06-04 21:38:03 +0200
commit9b08c60495603920baf3ab14607c702e1411bce6 (patch)
tree9302c5e235ff8293009c88260c60eba56697bfe9
parentc8ef121681b73748bb78a2fdefca5d5973491f25 (diff)
m_pgsql Same fix as 0e09600a431d0e0f2cde6457e088d84caf6d6f5d
-rw-r--r--src/modules/extra/m_pgsql.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 7751f9b82..ac247548a 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -412,16 +412,16 @@ restart:
if (param < p.size())
{
std::string parm = p[param++];
- char buffer[MAXBUF];
+ std::vector<char> buffer(parm.length() * 2 + 1);
#ifdef PGSQL_HAS_ESCAPECONN
int error;
- PQescapeStringConn(sql, buffer, parm.c_str(), parm.length(), &error);
+ size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error);
if (error)
ServerInstance->Logs->Log("m_pgsql", DEBUG, "BUG: Apparently PQescapeStringConn() failed");
#else
- PQescapeString (buffer, parm.c_str(), parm.length());
+ size_t escapedsize = PQescapeString(&buffer[0], parm.data(), parm.length());
#endif
- res.append(buffer);
+ res.append(&buffer[0], escapedsize);
}
}
}
@@ -447,16 +447,16 @@ restart:
if (it != p.end())
{
std::string parm = it->second;
- char buffer[MAXBUF];
+ std::vector<char> buffer(parm.length() * 2 + 1);
#ifdef PGSQL_HAS_ESCAPECONN
int error;
- PQescapeStringConn(sql, buffer, parm.c_str(), parm.length(), &error);
+ size_t escapedsize = PQescapeStringConn(sql, &buffer[0], parm.data(), parm.length(), &error);
if (error)
ServerInstance->Logs->Log("m_pgsql", DEBUG, "BUG: Apparently PQescapeStringConn() failed");
#else
- PQescapeString (buffer, parm.c_str(), parm.length());
+ size_t escapedsize = PQescapeString(&buffer[0], parm.data(), parm.length());
#endif
- res.append(buffer);
+ res.append(&buffer[0], escapedsize);
}
}
}