Skip to content

Commit bfc5bf9

Browse files
committed
Resolving build failure
1 parent ad448fe commit bfc5bf9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

mssql_python/pybind/ddbc_bindings.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <iostream>
1818
#include <utility> // std::forward
1919

20-
2120
//-------------------------------------------------------------------------------------------------
2221
// Macro definitions
2322
//-------------------------------------------------------------------------------------------------
@@ -69,7 +68,9 @@ inline py::object ParseSqlTimeTextToPythonObject(const char* timeText, SQLLEN ti
6968
if (timeTextLen == SQL_NO_TOTAL) {
7069
// When the driver reports SQL_NO_TOTAL, the buffer may not be null-terminated.
7170
// Bound the scan to the maximum expected TIME/TIME2 text length.
72-
len = static_cast<size_t>(std::strnlen(timeText, SQL_TIME_TEXT_MAX_LEN - 1));
71+
const void* nul = std::memchr(timeText, '\0', SQL_TIME_TEXT_MAX_LEN - 1);
72+
len = nul ? static_cast<size_t>(static_cast<const char*>(nul) - timeText)
73+
: static_cast<size_t>(SQL_TIME_TEXT_MAX_LEN - 1);
7374
} else {
7475
len = static_cast<size_t>(timeTextLen);
7576
if (len > SQL_TIME_TEXT_MAX_LEN - 1) {

0 commit comments

Comments
 (0)