Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions mssql_python/pybind/connection/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<py::int_>(value)) {
int intValue = value.cast<int>();
Expand All @@ -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<char>(0));
}
return ret;
}

Expand Down Expand Up @@ -383,4 +379,4 @@ py::object ConnectionHandle::getInfo(SQLUSMALLINT infoType) const {
ThrowStdException("Connection object is not initialized");
}
return _conn->getInfo(infoType);
}
}