summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r--src/corelib/tools/qbytearray.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 00d15fd518..8bae505d76 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -208,13 +208,14 @@ char *qstrncpy(char *dst, const char *src, uint len)
{
if (!src || !dst)
return 0;
+ if (len > 0) {
#if defined(_MSC_VER) && _MSC_VER >= 1400
- strncpy_s(dst, len, src, len-1);
+ strncpy_s(dst, len, src, len - 1);
#else
- strncpy(dst, src, len);
+ strncpy(dst, src, len);
#endif
- if (len > 0)
dst[len-1] = '\0';
+ }
return dst;
}