Fix using bulk operations with strings in Oracle backend

This was broken by c35b1b6a (Avoid disabling MSVC CRT security warnings
globally, 2025-06-08) which implicitly replaced std::strncpy() calls in
Oracle vector use type backend with the calls to soci::strncpy() which
doesn't behave in the same way as the standard function, e.g. it can't
be used with n==0 and it always NUL-terminates the destination buffer.

Restore the original strncpy() behaviour to fix this.

See #1268.
This commit is contained in:
Vadim Zeitlin
2026-07-02 19:37:05 +02:00
parent 9b34986861
commit 426a26c31f

View File

@@ -160,8 +160,12 @@ inline int sscanf(const char* str, const char* format, ...)
inline char* strncpy(char* dest, const char* src, size_t n)
{
strncpy_s(dest, n, src, _TRUNCATE);
return dest;
#pragma warning(push)
#pragma warning(disable:4996)
return std::strncpy(dest, src, n);
#pragma warning(pop)
}
#else // !_MSC_VER