diff --git a/mssql_python/pybind/connection/connection.cpp b/mssql_python/pybind/connection/connection.cpp index 3311c697..03178c4f 100644 --- a/mssql_python/pybind/connection/connection.cpp +++ b/mssql_python/pybind/connection/connection.cpp @@ -173,7 +173,7 @@ SQLRETURN Connection::setAttribute(SQLINTEGER attribute, py::object value) { LOG("Setting SQL attribute"); SQLPOINTER ptr = nullptr; SQLINTEGER length = 0; - std::string buffer; // to hold sensitive data temporarily + static std::string buffer; // to hold sensitive data temporarily if (py::isinstance(value)) { int intValue = value.cast(); @@ -196,10 +196,6 @@ SQLRETURN Connection::setAttribute(SQLINTEGER attribute, py::object value) { LOG("Set attribute successfully"); } - // Zero out sensitive data if used - if (!buffer.empty()) { - std::fill(buffer.begin(), buffer.end(), static_cast(0)); - } return ret; } @@ -383,4 +379,4 @@ py::object ConnectionHandle::getInfo(SQLUSMALLINT infoType) const { ThrowStdException("Connection object is not initialized"); } return _conn->getInfo(infoType); -} \ No newline at end of file +}