diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-05 06:39:30 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-05 13:57:12 +0200 |
commit | 657c2bfbeceda3faa2c7a76b4ccec6a65a3445a2 (patch) | |
tree | 83e0a1dab04afb291e181bb8fb6152ba96678795 /src/corelib/tools/qbytearray.cpp | |
parent | 676129d7ee57347798683d444823e7723776d8ec (diff) | |
parent | b94111116f09a6e48741d35cf7abea47af99ef26 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
tests/auto/testlib/selftests/generate_expected_output.py
Change-Id: If856162abf9a24ae2c9946d336a7d1da03520fa7
Diffstat (limited to 'src/corelib/tools/qbytearray.cpp')
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index c9d6f4e411..08a70a06c7 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -303,13 +303,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; } |