aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <[email protected]>2025-04-08 22:13:44 +0200
committerCristián Maureira-Fredes <[email protected]>2025-04-10 13:11:07 +0200
commitc4f60e640f831f12dfaf1042e39061428b3b876b (patch)
treeba98d738dec5c8c65425c0bed4b01a2d0e97dc5b /sources/shiboken6
parent7551a34b9ec237f03c0ca0eb75ffcf2c32f27115 (diff)
Replace strncpy by memcpy
Avoid a warning while building. Pick-to: 6.9 Change-Id: I4064c730bed07156027dd1bd0688622941286090 Reviewed-by: Friedemann Kleint <[email protected]>
Diffstat (limited to 'sources/shiboken6')
-rw-r--r--sources/shiboken6/libshiboken/helper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/shiboken6/libshiboken/helper.cpp b/sources/shiboken6/libshiboken/helper.cpp
index ab388812e..92f70f154 100644
--- a/sources/shiboken6/libshiboken/helper.cpp
+++ b/sources/shiboken6/libshiboken/helper.cpp
@@ -472,7 +472,8 @@ static char *strDup(const char *s) // strdup() using new[] for symmetry with the
{
auto len = std::strlen(s);
auto *result = new char[1 + len];
- std::strncpy(result, s, len);
+ // copy len-characters to avoid if we have a null terminator in the middle.
+ std::memcpy(result, s, len);
result[len] = '\0';
return result;
}