Skip to content

Commit ac231c1

Browse files
committed
copilot comment
1 parent 4f5abff commit ac231c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mssql_python/pybind/ddbc_bindings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ static py::object FetchLobColumnData(SQLHSTMT hStmt,
17531753
if (!isWideChar && chunk[copyCount - 1] == '\0') {
17541754
--copyCount;
17551755
LOG("Loop {}: Trimmed null terminator (narrow)", loopCount);
1756-
} else if (isWideChar) {
1756+
} else if (copyCount >= sizeof(wchar_t)) {
17571757
auto wcharBuf = reinterpret_cast<const wchar_t*>(chunk.data());
17581758
if (wcharBuf[(copyCount / sizeof(wchar_t)) - 1] == L'\0') {
17591759
copyCount -= sizeof(wchar_t);
@@ -1771,7 +1771,7 @@ static py::object FetchLobColumnData(SQLHSTMT hStmt,
17711771
}
17721772
}
17731773
LOG("FetchLobColumnData: Total bytes collected = {}", buffer.size());
1774-
1774+
17751775
if (indicator == 0 || buffer.empty()) {
17761776
LOG("FetchLobColumnData: Returning empty string for col {}", colIndex);
17771777
return py::str("");

0 commit comments

Comments
 (0)