mirror of
https://github.com/allankoechke/soci.git
synced 2026-11-30 10:58:24 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user